Skip to content

Backend Routes

Mystik edited this page Mar 18, 2020 · 2 revisions

Submitting a vote:

Route: /vote

Request Type: POST

Format of data returned:

{
    "submitter": <string>,
    "vote": <decimal>
}

Submitting sensor data:

Route: /sensorSubmit

Request Type: POST

Format of data to be sent:

{
    "id": <int>,
    "location": <string>,    // The sensor's desk number
    "temperature": <decimal>,
    "time": <string>
}

Requesting all sensor data:

Route: /sensorData

Request Type: GET

Example:

{
    "sensors": [
        {
            "id": 3,
            "location": "2D042",
            "temperature": 21.3,
            "time": "12:06:21T18:3:2020"
        },
        {
            "id": 83,
            "location": "2D041",
            "temperature": 20.9,
            "time": "12:06:40T18:3:2020"
        },
        ...
    ]
}

Possible returned status codes:

  • 200 if the data was found and returned properly
  • 204 if no sensor data exists

Requesting a specific sensor's data:

Route: /sensorSubmit?id=<int>

Request Type: GET

Format of data returned:

{
    "id": <int>,
    "location": <string>,    // The sensor's desk number
    "temperature": <decimal>,
    "time": <string>
}

Possible returned status codes:

  • 200 if the specified sensor exists
  • 204 if no sensor data exists
  • 404 if the specified sensor wasn't found

Clone this wiki locally