Paging
With paging query parameters you can change the size of response data array and iterate response loading.
Paging query parameters
Examples: page=1 , page=1&limit=20
| Query parameter | Description | Default | Range |
|---|---|---|---|
| page | Selected page | 1 | (1, ...) |
| limit | Max items on a page (step). | 20 | (1, 100) |
Paging response structure
// page=1 limit=10
{
"currentPage": 1,
"perPage": 10, //= limit max items on page
"totalItemsOnPage": 10, // number of items on actual page
"totalItemsCount": 25, // total items count for whole data
"firstPage": 1,
"lastPage": 3,
"nextPage": 2,
"prevPage": null,
"data": [
...
]
}
currentPage Int
The current page.
perPage Int
Maximum items (limit) on a page.
totalItemsOnPage Int
Number of items on the actual page.
totalItemsCount Int?
Total items count for the whole data. It may be null for some entities [1].
firstPage Int
The first page. It should always be equal to 1.
lastPage Int?
The last page. It can be null for some entities [1].
It will be equal to 0 in the future if there are no data but now the API2 returns HTTP 404 Not Found.
nextPage Int?
The next page or null if on the last page.
prevPage Int?
The previous page or null if on the first page.
data List
The list of entities.
[1] Some endpoints do not count all the records because it would negatively impact the performance. Endpoints for the following entities return totalItemsCount=null and lastPage=null currently (but it can change in the future):
- Order
- OrderItem
In such situations you can advance to the next page and repeat until you get a result with
totalItemsOnPage < perPageor an HTTP error 404 Not Found.
Paging examples
| Description | Page query parameters |
|---|---|
| Page 2, data per 20 items | page=2&limit=20 |
| Page 3, default limit | page=3 |