#
Api responses
The easyroam API has 3 types of responses which all share a similiar structure. The response types are:
- Default
- Paginated enumeration
- Error
#
Default response
The default response is the most common response type. It is used for all endpoints that return a single entity or a list of entities that are not paginated. The response has the following structure:
{
"result": "ok",
"code": 200,
"data": "object|array"
}
The type of the data
field will vary from endpoint to endpoint, with specifics being explained in the different sections for the endpoints. The code
field will always be 200
for a successful request.
#
Paginated enumeration response
The paginated enumeration response is similar to the default response and is used for endpoints that return a list of entities that are paginated. The response has the following structure:
{
"result": "ok",
"code": 200,
"data": [
{
}
],
"limit": 10,
"offset": 0,
"total": 1
}
The data
field is an array of entities, the limit
field is the number of entities per page, the offset
field is the offset of the current page and the total
field is the total number of entities. The code
field will always be 200
for a successful request.
#
Error response
The error response is used when an error occurs. The response has the following structure:
{
"result": "error",
"code": 400,
"error": "string",
"error_description": "string",
"request_id": "string"
}
The code
field will be the HTTP status code of the error, the error
field will be a short description of the error, the error_description
field will be a longer description of the error and the request_id
field will be a unique identifier for the request. The result
field will always be error
for an error response.