improved

API - Pagination added to the "devices" endpoint

✨ Improvements

There's a limit to the size of a response from our API, so to avoid breaking that limit, we've added pagination to the /devices endpoint.

The limit to number of devices returned from the request can be defined by using the limit parameter, with a maximum of 5 000 devices per page. If the parameter is not set, and there are more than 5 000 devices in the account, the API will provide a 400 Bad Request response and let you know that pagination should be used for the request.

The response from the /devices endpoint with pagination enabled will return the offset used to retrieve the next page, as well as the total amount of devices in the account.

Example response from GET /devices?limit=1&offset=50 :

{
    "devices": [
        {
            "id": "2930000000",
            "deviceType": "WAVE_PLUS",
            "sensors": [
                "radonShortTermAvg",
                "temp",
                "humidity",
                "pressure",
                "co2",
                "voc",
                "light",
                "virusRisk"
            ],
            "segment": {
                "id": "00000000-0000-0000-0000-0000000000",
                "name": "Device Name",
                "started": "2021-07-09T14:00:06",
                "active": true
            },
            "location": {
                "id": "00000000-0000-0000-0000-0000000000",
                "name": "Location Name"
            }
        }
    ],
    "limit": 1,
    "offset": 51,
    "total": 554
}