Pagination¶
Every API call that returns a list of items will be paginated. This includes the following endpoints:
- Device List
- Device Interface List
- Device Packet List
- Device Readings List
- Folders List
- Folders Device List
- Folders Packet List
- Folders Readings List
- Parser List
Parameters for Pagination¶
To paginate, the following parameters may be used:
Parameter | Example | Meaning |
---|---|---|
limit | 10 | Amount of list items to retrieve. Defaults to 10 . Must be a valid integer between 0 and 100. |
sort | name | Property on the paginated item to sort by. Defaults to inserted_at if not stated otherwise. |
sort_direction | ascending | Direction of the sort defined in the sort parameter. Can be either ascending or descending . Defaults to descending . |
retrieve_after | 881af0c9-72c2-4758-af09-4901bef0c15c | ID of the last paginated item from where to paginate from depending on the sort and sort_direction parameters. For example: if sort=inserted_at and sort_direction=descending , then only items older than the item with the specified ID will be returned. |
before | 2017-09-05T13:46:47.956173Z | Return only items that were created before a certain time. Allowed date types are listed below. |
after | 2017-09-04T03:12:02.882313Z | Return only items that were created after a certain time. Allowed date types are listed below. |
Supported Date Types¶
The before
and after
parameters may be expressed as these types:
- Unix Epoch Timestamp: number of seconds since UNIX epoch
- ISO 8601 Basic:
<date>T<time><offset>
. Full date and time specification without separators. - ISO 8601 Basic Z:
<date>T<time>Z
. Full date and time in UTC without separators (e.g.20070813T134801Z
) - ISO 8601 Extended:
<date>T<time><offset>
. Full date and time specification with separators. (e.g.2007-08-13T16:48:01 +03:00
) - ISO 8601 Extended Z:
<date>T<time>Z
. Full date and time in UTC. (e.g.2007-08-13T13:48:01Z
) - ISO 8601 Date:
YYYY-MM-DD
. That is, 4-digit year number, followed by 2-digit month and day numbers (e.g.2007-08-13
)
The retrieve_after_id
Property¶
Every API call that returns a list in the body
field will also return a retrieve_after_id
property on the root level. This field contains the ID of the last item in the list and should be used for further pagination.
{
"status": 200,
"retrieve_after_id": "0ff0c75a-b2ac-4051-a2df-d2c0fa97655c",
"ok": true,
"body": [ /* Items */ ]
}