Skip to content

Equipment API Documentation

ege-kaya edited this page Jan 3, 2022 · 11 revisions

Get equipment by id

GET 'api/equipments/<id>/'

  • Author: Ege Can Kaya

  • Definition: Allows a user to fetch an equipment from database

  • Example Response Value:

    {
        "@context": "https://www.w3.org/ns/activitystreams",
        "summary": "MaxVerstappen posted an equipment",
        "type": "Create",
        "actor": {
            "type": "Person",
            "name": "MaxVerstappen"
        },
        "object": {
            "type": "Equipment",
            "postId": "",
            "ownerId": "",
            "content": "I can't drive it so I'm selling it",
            "title": "Unused F1 car with Honda engine",
            "creationDate": "2014-11-31T23:00:00-08:00",
            "lastUpdateDate": "2014-11-31T23:00:00-08:00",
            "numberOfClicks": 0,
            "location": {
                "name": "Red Bull Racing HQ, Milton Keynes",
                "type": "Place",
                "longitude": 52.007877,
                "latitude": -0.692203,
                "altitude": 76,
                "units": "m"
            },
            "url":"https://www.redbullracing.com/adverts",
            "sport": "F1",
            "equipmentType": "Car"
        }
    } 
  • Parameters

    Parameter Description Parameter Type Data Type
    id ID of the searched equipment Path Int
  • Response Messages

    • 200: Ok.
    • 404: Not Found.

Get all equipments

GET 'api/equipments/'

  • Author: Ege Can Kaya

  • Definition: Returns a list of post ids using filters.

  • Example Response Value:

    { 
        "@context": "https://www.w3.org/ns/activitystreams",
        "summary": "Object history",
        "type": "OrderedCollection",
        "totalItems": 2,
        "totalPages": 2,
        "orderedItems": [ 
            { 
                "object": "/api/equipments/1/" 
            },
            { 
                "object": "/api/equipments/2/" 
            } 
        ] 
    } 
  • Parameters

    Parameter Description Parameter Type Data Type
    query Query string Query String
    creation_date Creation date of the searched equipment Body DateTime
    location Location of the searched equipment Body String
    sport Sport type of the searched equipment Body Char
    latitude Latitude of the searched event Body Float
    longitude Longitude of the searched event Body Float
    owner Owner of the searched event Body User
    equipment_type Equipment type of the searched equipment Body String
  • Response Messages

    • 200: Ok.

Get equipments in pages

GET 'api/equipments?page=<page>'

  • Author: Ege Can Kaya

  • Definition: Returns a list of equipment ids using filters.

  • Example Response Value:

    [1,2,3]
  • Parameters

    Parameter Description Parameter Type Data Type
    page Page of the list of events Query Integer
  • Response Messages

    • 200: Ok.
    • 500: Internal server error.

Create an equipment

POST 'api/equipments/'

  • Author: Ege Can Kaya

  • Definition: Allows a user to create an event

  • Example Response Value:

    {
        "@context": "https://www.w3.org/ns/activitystreams",
        "summary": "MaxVerstappen posted an equipment",
        "type": "Create",
        "actor": {
            "type": "Person",
            "name": "MaxVerstappen"
        },
        "object": {
            "type": "Equipment",
            "postId": "",
            "ownerId": "",
            "content": "I can't drive it so I'm selling it",
            "title": "Unused F1 car with Honda engine",
            "creationDate": "2014-11-31T23:00:00-08:00",
            "lastUpdateDate": "2014-11-31T23:00:00-08:00",
            "numberOfClicks": 0,
            "location": {
                "name": "Red Bull Racing HQ, Milton Keynes",
                "type": "Place",
                "longitude": 52.007877,
                "latitude": -0.692203,
                "altitude": 76,
                "units": "m"
            },
            "url":"https://www.redbullracing.com/adverts",
            "sport": "F1",
            "equipmentType": "Car"
        }
    } 
  • Parameters

    Parameter Description Parameter Type Data Type
    content Content of the created equipment Body String
    title Title of the created equipment Body String
    location Location of the created equipment Body String
    sport Sport type of the created equipment Body Char
    latitude Latitude of the created equipment Body Float
    longitude Longitude of the created equipment Body Float
    owner Owner of the created equipment Body User
    equipment_type Type of the created equipment Body String
    url URL of the created equipment Body String
  • Response Messages

    • 201: Created.
    • 400: Bad request.
Clone this wiki locally