Skip to main content
Version: 1.1.0

Pagination

Overview

Alloy's Unified API allows you to quickly paginate through large data sets with ease. At the end of every list endpoint, you'll find a pageInfo object as seen below.

JSON
{
"data": [
{...},
{...},
{...},
],
"pageInfo": {
"hasNext": true,
"nextCursor": "eyJpdGVtSWQiOnsiUyI6IjZhNmIwYTk2LTlmM2YtNDZkNS1iMjBlLTRkODk0ZjA2NWZjZSJ9LCJkYXRhQnVja2V0Ijp7IlMiOiI2MWE5Mjk1MTBjNTdmYjAwMTQzNzhkNzEvY3VzdG9tZXIifX0="
}
}

Pagination Cursor

ParameterTypeDescription
hasNextbooleanDenotes if there is another page available. If pagination is available, the nextCursor value will return a value and hasNext will return true. This parameter defaults to false otherwise.
nextCursorstringThe cursor you must pass to subsequent API requests to paginate. It will return null if there is nothing to paginate through.

Below you can find a sample request showing how to paginate through large data sets using the nextCursor value.

Sample Request

cURL
curl --location 'https://embedded.runalloy.com/2023-12/one/commerce/customers?connectionId=YOUR_CONNECTION_ID&cursor=YOUR_CURSOR' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Accept: application/json'

Page Size

You can also specify the number of items to be returned by passing the pageSize query parameter to any list request as seen in the sample request below. You can specify a maximum pageSize of 100.

Sample Request

cURL
curl --location 'https://embedded.runalloy.com/2023-12/one/commerce/customers?connectionId=YOUR_CONNECTION_ID&pageSize=2' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Accept: application/json'

Wrapping Up

In this article, we took a look at how to paginate through requests using Alloy's Unified API.