Pagination

Overview of the pagination syntax.

Filtering Overview

The Zylo Enterprise API provides pagination to GET endpoints that return multiple resources. The query parameters to control pagination are limit, skip, and cursor.

Choosing a pagination option

skip is best used when sorting by a specific field, such as supporting a custom UI. The cursor option is preferred when retrieving all records for tasks like populating or syncing with an external data source, where the order of records is not important.

Using limit parameter

To apply a limit to a GET call that returns multiple resources, use the below syntax:

/v2/applications?limit=500

If no limit is provided, the default returned will be 50. The max number that can be set is 1000.

Using skip parameter

To apply an offset to a GET call that returns multiple resources, use the below syntax:

/v2/applications?skip=50

If no skip is provided, the default offset will be set to 0.

Using limit and skip for pagination

To paginate through requests, use limit and skip together. Below is an example of using the two query parameters together to paginate through the resources.

# First Request
/v2/applications?limit=500&skip=0

# Second Request
/v2/applications?limit=500&skip=500

# Third Request
/v2/applications?limit=500&skip=1000

The below example would retrieve 1500 applications in three requests.

Using cursor parameter

Cursor pagination is the most performant option for retrieving large set of data that span many pages. Using cursor pagination requires sort=id.

/v2/applications?sort=id

After retrieving the first page, the response header will contain an x-cursor which is the id value of the last record returned in that response.

x-cursor: a8098c1a-f86e-11da-bd1a-00112444be1e

Use the provided x-cursor value when making subsequent requests using the cursor query parameter.

/v2/applications?sort=id&cursor=a8098c1a-f86e-11da-bd1a-00112444be1e

Using limit and cursor for pagination

Using limit is supported with the cursor option for pagination to retrieve pages larger than the default value, 50.