All GET endpoints that return more than one item are paginated, by default by 15 items per page. In this documentation, a GET endpoint will be identified by a ”○” symbol if it supports pagination.
Here is an example of a paginated response sent with the query parameters per_page=15&page=1
:
Note: If you omit per_page
from the query string, the default page size of 15 will be used
and that value will not be included in the response’s query strings.
{
"data": [
{
// Object 1
},
{
// Object 2
},
{
// Object 3
},
...
],
"links": {
"first": "https://{{domain}}/v1/{{endpoint}}?per_page=15&page=1",
"last": "https://{{domain}}/v1/{{endpoint}}?per_page=15&page=3",
"prev": null,
"next": "https://{{domain}}/v1/{{endpoint}}?per_page=15&page=2"
},
"meta": {
"current_page": 1,
"from": 1, // Index of the first item on this page
"last_page": 3,
"links": [
{
"url": null,
"label": "Previous",
"active": false
},
{
"url": "https://{{domain}}/v1/{{endpoint}}?per_page=15&page=1",
"label": "1",
"active": true
},
{
"url": "https://{{domain}}/v1/{{endpoint}}?per_page=15&page=2",
"label": "2",
"active": false
},
{
"url": "https://{{domain}}/v1/{{endpoint}}?per_page=15&page=3",
"label": "3",
"active": false
},
{
"url": "https://{{domain}}/v1/{{endpoint}}?per_page=15&page=2",
"label": "Next",
"active": false
}
],
"path": "https://{{domain}}/v1/{{endpoint}}",
"per_page": 15,
"to": 15 // Index of the last item on this page
"total": 45 // Total number of items
}
}
You can control the page size by using the per_page
query string parameter, and the page number by using the page
query string parameter. For example:
curl -X GET https://api.disguise.cloud/v1/organisation?per_page=20&page=2 \
-H "Authorization: Token YOUR_API_TOKEN"
This request will return the second page of results, with 20 items per page.
We recommend setting the per_page
parameter to a reasonable value to avoid performance issues. For best performance on most endpoints, we recommend a value between 10 and 100.