Pagination
How to paginate datasets using the APIs
The Management API implements a standard pagination scheme for all GET collection endpoints. This allows you to specify which page you're on and obtain details about the entire collection.
curl --request GET \
--url "https://app.getcensus.com/api/v1/syncs?page=1&per_page=25&order=asc" \
--header 'Authorization: <authorization>'
{
"status": "success",
"data": [
// record values
],
"next": "https://app.getcensus.com/api/v1/syncs?page=2&per_page=25",
"pagination": {
"total_records": 240,
"per_page": 25,
"prev_page": null,
"page": 1,
"next_page": 2,
"last_page": 10
}
}
Request URL Parameters
You can utilize the following URL parameters to influence the response:
| Parameter | Type | Default | Description |
|---|---|---|---|
page | number | 1 | Designates which page of results to return. Always starts at 1. If 0 is specified, it defaults to 1. |
per_page | number | 25 (max 100) | Determines the number of results on each page. It can't exceed 100. |
order | asc or desc | desc | Organizes the results based on their creation time, either ascending or descending. |
Response Pagination Data
Each response for a collection request includes a pagination object containing:
| Field | Type | Description |
|---|---|---|
total_records | number | Total records in the collection. |
per_page | number | Records on each page. |
prev_page | number | The previous page number, or null for the first page. |
page | number | The current page number. |
next_page | number | The next page number, or null if it's the last page. |
last_page | number | The number of the last page with records. |
Note: The response body may also contain a next field, presenting a fully-qualified URL to the next set of results. This field is being phased out in favor of the pagination object but remains present for now.