Skip to main content

Pagination


Most endpoints that return a list of objects use pagination with a limited amount of entries per page. When an api request is made without a page number, the endpoint will return the first page of the collection by default.

An example response would look like this:

{
"entries": [
{
...
},
{
...
}
],
"current_page": 1,
"per_page": 30,
"total_entries": 2
}

By passing the parameter page, with the specified page number, to the api request, you can specify the page to be returned by the endpoint.

Example Request

GET services/api/v1/employees?page=2

Example Response

{
"entries": [
{
...
}
],
"current_page": 2,
"per_page": 30,
"total_entries": 31
}

When a bigger number than (total_entries / per_page).ceil() is passed to the page parameter, the endpoint will return an empty entries array and the pagination information, like in the following example:

{
"entries": [],
"current_page": 2,
"per_page": 30,
"total_entries": 1
}