Skip to main content

Pagination

Learn how to paginate bulk data requests to the Calry API.

Overview​

Calry API endpoints that return a list of objects will be paginated to 10 items by default.

  1. Pagination is specified via the cursors and limit query parameters.
  2. The previous, current and next are attached to paginated API responses. Their values inform the cursor where to point to next.

Parameters​

  1. cursors (integer - optional) - The cursors value to start paginating from. The cursor parameter is used to specify the starting point of the next page of results. The cursor value is returned in the next field of a paginated API response. If the next field is not present, then there are no more pages to retrieve.
  2. limit (integer - optional) - The number of items to return per page. The limit parameter is used to specify the number of results returned per page. The default value is 10 and the maximum allowed value is 200. If the limit parameter is not specified, then the default value is used.

Meta Object​

The meta object is returned at the root with every paginated response payload. It contains information about the query that was performed.

{
"data": [
{...},
{...},
{...},
...
],
"meta": {
"limit": 10,
"cursors": {
"previous": "",
"current": "1",
"next": "2"
}
}
}

Cursors​

The cursors object is used to specify the starting point of the next page of results. In the response payload of an API request to a paginated endpoint, you can find next and previous cursors.

GET /api/vrs/reservations?cursor=2

{
"data": [
{...},
{...},
{...},
...
],
"meta": {
"limit": 10,
"cursors": {
"previous": "1",
"current": "2",
"next": "3"
}
}
}

Limit​

The limit parameter is used to limit the number of results returned. For example, if you wanted to limit the results to 20, you would use limit=20 as a query string parameter in the URL. If you do not define a limit, the default is 10.

GET /api/vrs/reservations?limit=20

{
"data": [
{...},
{...},
{...},
...
],
"meta": {
"limit": 20,
"cursors": {
"previous": "",
"current": "1",
"next": ""
}
}
}

Example​

Below is an sample request using pagination in HTTP. The limit is set to 20, and the cursor is pointing to a value for the next page.

GET /api/vrs/reservations/?limit=20&cursor=2

integrationAccountId: {Integration Account Id}
Authorization: Bearer {API Key}
workspaceId: {Workspace Id}