Hapcat Server API

GET /

Dump the routes for debugging.

See the API docs for details.

GET /api/serverinfo/

Redirect to the latest API version serverinfo.

Status Codes:

Example request:

http

GET /api/serverinfo/ HTTP/1.0

curl

curl -i http://nohost/api/serverinfo/

Example response:

HTTP/1.0 302 FOUND
Location: http://localhost:8080/api/v0/serverinfo/
GET /api/v(int: version)/event/(event)

Get the given event’s info.

Query Parameters:
 
  • version – The version of the API currently in use
  • event – The UUID of the event to get info for
Status Codes:
Response JSON Object:
 
  • id (UUID) – The event ID
  • name (string) – The tag name
  • location (UUID) – The raw location this event takes place at
  • type (string) – event
  • tags – The tag IDs for this event

Example request:

http

GET /api/v0/event/b0a28a40-b8ad-4131-8c64-071f3fd45bee HTTP/1.0
Accept: application/json

curl

curl -i http://nohost/api/v0/event/b0a28a40-b8ad-4131-8c64-071f3fd45bee -H 'Accept: application/json'

Example success:

HTTP/1.0 200 OK
Content-Type: application/json

{
    "id": "b0a28a40-b8ad-4131-8c64-071f3fd45bee",
    "name": "The Accidentals - Concert at the Kent Stage",
    "location": "cbedf9e2-4a1a-44b9-9e3f-6fe870405329",
    "tags": [
        "64b9eae5-b220-4a57-92f4-c21dc9b19ec5",
        "71f450ef-b344-45f3-9b60-0dbda7fce2f0",
        "f8ddde82-331e-43c2-a2fd-985c5eb8fe52"
    ],
    "type": "event"
}

Example failure:

HTTP/1.0 400 BAD REQUEST
Content-Type: application/json

{
    "status": "failure",
    "message": "Invalid event ID"
}
GET /api/v(int: version)/location/(location)

Get the given location’s info.

Query Parameters:
 
  • version – The version of the API currently in use
  • location – The UUID of the location to get info for
Status Codes:
Response JSON Object:
 
  • id (uuid) – The location ID.
  • address (string) – The location address.
  • ephemeral (boolean) – If true, this location is just an address for events.
  • name (string) – The location name if not ephemeral.
  • tags – The tag IDs for this location if not ephemeral.
  • type (string) – rawlocation or location.

Example request:

http

GET /api/v0/location/a25a1b9a-2f5a-4c76-b19f-eb970d2c7049 HTTP/1.0
Accept: application/json

curl

curl -i http://nohost/api/v0/location/a25a1b9a-2f5a-4c76-b19f-eb970d2c7049 -H 'Accept: application/json'

Example success, normal location:

HTTP/1.0 200 OK
Content-Type: application/json

{
    "id": "a25a1b9a-2f5a-4c76-b19f-eb970d2c7049",
    "address": "1444 E Main St, Kent, OH 44240",
    "name": "Hungry Howie's Pizza",
    "ephemeral": false,
    "tags": [
        "17b20e68-8cde-4bc3-91a2-f5926a3e2b0f",
        "0e858a8b-cd18-4617-8a94-2a8bab4945a9",
        "d6f2989d-d5c0-477d-a8a4-d22e47087ab2"
    ]
}

Example success, raw/ephemeral location:

HTTP/1.0 200 OK
Content-Type: application/json

{
    "id": "cbedf9e2-4a1a-44b9-9e3f-6fe870405329",
    "address": "175 E Main St, Kent, OH 44240",
    "ephemeral": true
}

Example failure:

HTTP/1.0 400 BAD REQUEST
Content-Type: application/json

{
    "status": "failure",
    "message": "Invalid location ID"
}
POST /api/v(int: version)/register/
POST /api/v(int: version)/registration/

Register the given user.

Query Parameters:
 
  • version – The version of the API currently in use.
Request JSON Object:
 
  • username (string) – The requested username.
  • email (string) – The user’s email address.
  • date_of_birth – The user’s date of birth.
  • password (string) – The user’s password.
Response JSON Object:
 
  • status (string) – success or failure.
  • username (string) – The username.
  • message (string) – An optional message on failure.
Status Codes:

Example request:

http

POST /api/v0/registration/ HTTP/1.0
Accept: application/json
Content-Type: application/json

{
    "username": "user",
    "password": "password",
    "email": "user@example.com",
    "date_of_birth": {
        "year": 1999,
        "month": 9,
        "day": 9
    }
}

curl

curl -i -X POST http://nohost/api/v0/registration/ -H 'Accept: application/json' -H 'Content-Type: application/json' --data-raw '{"date_of_birth": {"day": 9, "month": 9, "year": 1999}, "email": "user@example.com", "password": "password", "username": "user"}'

Example success:

HTTP/1.0 200 OK
Content-Type: application/json

{
    "status": "success",
    "username": "user"
}

Example failure:

HTTP/1.0 409 CONFLICT
Content-Type: application/json

{
    "status": "failure",
    "username": "user",
    "message": "Username already exists"
}
GET /api/v(int: version)/serverinfo/

Get the server info.

Query Parameters:
 
  • version – The version of the API currently in use
Response JSON Object:
 
  • server_version (string) – The version of the backend
  • api_versions (list(int)) – The supported API versions
Status Codes:

Example request:

http

GET /api/v0/serverinfo/ HTTP/1.0
Accept: application/json

curl

curl -i http://nohost/api/v0/serverinfo/ -H 'Accept: application/json'

Example response:

HTTP/1.0 200 OK
Content-Type: application/json

{
    "server_version": "0.0.2.dev10",
    "api_versions": [
        0
    ]
}
GET /api/v(int: version)/suggestions/

Send our suggestions.

Query Parameters:
 
  • version – The version of the API currently in use
Response JSON Object:
 
Status Codes:

Example request:

http

GET /api/v0/suggestions/ HTTP/1.0
Accept: application/json

curl

curl -i http://nohost/api/v0/suggestions/ -H 'Accept: application/json'

Example response:

HTTP/1.0 200 OK
Content-Type: application/json

{
    "tags": {
        "d927d94f-beb8-4295-ac78-5c00e6dc217c": {
            "id": "d927d94f-beb8-4295-ac78-5c00e6dc217c",
            "name": "healthy"
        }
        "64b9eae5-b220-4a57-92f4-c21dc9b19ec5": {
            "id": "64b9eae5-b220-4a57-92f4-c21dc9b19ec5",
            "name": "concert"
        },
    },
    "locations": {
        "f8293fe1-d439-4a4d-ac84-5e8290a28c23": {
            "address": "1075 Risman Dr, Kent, OH 44242",
            "tags": [
                "d927d94f-beb8-4295-ac78-5c00e6dc217c",
            ],
            "id": "f8293fe1-d439-4a4d-ac84-5e8290a28c23",
            "name": "Fresco",
            "photos": [
                "https://media-cdn.tripadvisor.com/media/photo-s/03/2b/02/a1/fresco-mexican-grill.jpg"
            ]
        }
        "cbedf9e2-4a1a-44b9-9e3f-6fe870405329": {
            "address": "175 E Main St, Kent, OH 44240",
            "ephemeral": true,
            "id": "cbedf9e2-4a1a-44b9-9e3f-6fe870405329"
        },
    },
    "events": {
        "b0a28a40-b8ad-4131-8c64-071f3fd45bee": {
            "location": "cbedf9e2-4a1a-44b9-9e3f-6fe870405329",
            "id": "b0a28a40-b8ad-4131-8c64-071f3fd45bee",
            "name": "The Accidentals - Concert at the Kent Stage",
            "photos": [
                "https://image-ticketfly.imgix.net/00/02/83/80/81-og.jpg"
            ],
            "tags": [
                "64b9eae5-b220-4a57-92f4-c21dc9b19ec5",
            ]
        }
    },
    "order": [
        {
            "section": "locations",
            "id": "f8293fe1-d439-4a4d-ac84-5e8290a28c23"
        },
        {
            "section": "events",
            "id": "b0a28a40-b8ad-4131-8c64-071f3fd45bee"
        }
    ]
}
GET /api/v(int: version)/tag/(tag)

Get the given tag’s info.

Query Parameters:
 
  • version – The version of the API currently in use
  • tag – The UUID of the tag to get info for
Status Codes:
Response JSON Object:
 
  • id (UUID) – The tag ID
  • name (string) – The tag name
  • type (string) – tag

Example request:

http

GET /api/v0/tag/d927d94f-beb8-4295-ac78-5c00e6dc217c HTTP/1.0
Accept: application/json

curl

curl -i http://nohost/api/v0/tag/d927d94f-beb8-4295-ac78-5c00e6dc217c -H 'Accept: application/json'

Example success:

HTTP/1.0 200 OK
Content-Type: application/json

{
    "id": "d927d94f-beb8-4295-ac78-5c00e6dc217c",
    "name": "healthy",
    "type": "tag"
}

Example failure:

HTTP/1.0 400 BAD REQUEST
Content-Type: application/json

{
    "status": "failure",
    "message": "Invalid tag ID"
}
GET /debug/dropalldata/

Drop all data.

A request to this drops all data in the database.

GET /debug/reloadtestdata/

Load our test data for debugging.

A request to this reloads the test data into the database.

GET /flask-api/static/(path: filename)

Function used internally to send static files from the static folder to the browser.

New in version 0.5.

GET /static/(path: filename)

Function used internally to send static files from the static folder to the browser.

New in version 0.5.