Pagination
Some routes are paginated. This is the case for instance for retrieving your search results or the bulk files.
Below, you'll find how to deal with the pagination system.
First request
For the first request, you just have to give the limit
(the number of data you want to fetch) in your request:
{
"limit": 30,
...rest of your request
}
The system will respond with the total
number of elements and a sorts
array containing two elements:
{
"sorts": [
[125432Z65, "xxxx"],
[5643645, "yyyy"],
],
"total": 1000,
...rest of the response
}
You need to keep the sorts
array somewhere as it is necessary for the subsequent requests.
Subsequent requests
For the subsequent requests, you need to give:
- The
limit
; - The
next
boolean;true
if you want to go forward (i.e. next page) andfalse
if you want to go backward (i.e. previous page). - The
sorts
array as it was returned to you by the system.
{
"limit": 30,
"next": true, // fetch next page
"sorts": [
[125432Z65, "xxxx"],
[5643645, "yyyy"],
],
...rest of your request
}
The system will respond with a new sort array, that you need to store. This is the one that you are going to use for the next request.
You need to repeat this process until no new results are returned.