To allow the API Query to be able to fetch very large requests, they are automatically split into "pages" of data returned. The default and maximum page size depend on the endpoint; see each endpoint's reference page.
APIs that support pagination, accept two optional query parameters:
| Parameter Name | Description | Default Value |
|---|---|---|
| page | Page number of the total data to return (starting from 1) | 1 |
| per_page | Data entries to return per page | 100 (unless otherwise specified) |
The query will return the data in the following format:
{
"items": [],
"next_page": null
}
Some endpoints return has_next_page instead of, or in addition to, next_page. Check the endpoint's reference page for the exact fields.
| Field | Description |
|---|---|
| items | An array of entries returned for this query |
| next_page | The next page number to request, or null on the last page. |
| has_next_page | A value of true signifies there are more pages of data available, to retrieve more entries another query should be made with the pageparamter increased by 1. |
| total_count | Returned by Get Incidents only: the number of matching entries across all pages. |
Sample pseudo-code
page = 1
finished = false
while (!finished) {
returned_data = query_api("url&page={page}")
if (returned_data.next_page == null && !returned_data.has_next_page) {
finished = true
} else {
page = page + 1
}
process_data(returned_data.items)
}
Errors
Passing invalid values to the pageor per_pagewill result in 422errors.
