Skip to content

Latest commit

 

History

History
138 lines (112 loc) · 5.05 KB

File metadata and controls

138 lines (112 loc) · 5.05 KB

Cross-endpoint responses

Some endpoints share responses. These shared responses are documented here and are linked in the documentation of the individual endpoints.

Table of contents

Responses from endpoints that require an access token

Also check out: Obtaining an access token!

Response 401 UNAUTHORIZED - No access token

{
    "errors": [
        "Access to this resource requires a valid access-token."
    ]
}

Response 403 FORBIDDEN - Not an admin

{
    "errors": [
        "Only administrators are allowed to access this endpoint."
    ]
}

Only for endpoints which can only be accessed by administrators.

Response 403 FORBIDDEN - Invalid access token

{
    "errors": [
        "The access-token sent is invalid or no longer accepted."
    ]
}

Responses for requests with JSON bodies

Response 400 BAD REQUEST - No JSON in body

{
    "errors": [
        "You must provide the data in the body as JSON."
    ]
}

Response 400 BAD REQUEST - Wrong value format

{
    "errors": [
        "Some or more values ​​in the JSON body were null or do not correspond to the required column type in the database."
    ]
}

Responses for requests that try to add already existing objects to the database

Response 409 CONFLICT - Already in database

{
    "errors": [
        "A ... (...) is already present in the database."
    ]
}

The object's type (first points) and its identifier (second points) of the object are sent in the response.

Responses for requests which try to query resources that do not exist in the database

{
    "errors": [
        "The ... (...) is not present in the database."
    ]
}

The object's type (first points) and its identifier (second points) of the object are sent in the response.

Responses for requests which delete database objects

Response 200 OK

{
    "messages": [
        "The ... (...) was successfully deleted from the database."
    ]
}

The object's type (first points) and its identifier (second points) of the object are sent in the response.

Responses to requests that result in server-side communication with another MQTT server

RESPONSE 502 BAD GATEWAY - MQTT server cannot be reached

{
    "errors": [
        "The MQTT server to which this request should be forwarded cannot be reached."
    ]
}

If this response comes back, the MQTT server is either offline or the URI to the MQTT server has been misconfigured in the backend. In both cases, You should notify the administration of the respective server.

Responses for requests that call endpoints that can only be called by users assigned to the queried experiments

Response 404 NOT_FOUND - User not assigned to the experiment

{
    "errors": [
        "Only users that are assigned to the experiment can access it."
    ]
}

If the endpoint can be used without restrictions by administrators, the error message is modified as follows: Only users that are assigned to the experiment and admins can access it.