Pagination
Overview
Alloy's Unified API allows you to quickly paginate through large data sets with ease.
This section of the documentation explains how to navigate through large datasets using pagination with our API. Understanding and implementing pagination correctly is crucial for optimizing the performance of your API requests and improving the user experience by efficiently managing large sets of data.
Pagination Parameters
Our API uses two primary parameters to handle pagination: pageNumber
and pageSize
. These parameters allow you to control which portion of the data you receive, making data retrieval both manageable and efficient.
Parameter | Type | Description | Default |
---|---|---|---|
pageNumber | Integer | Indicates the current page number of the results you wish to retrieve. | 1 |
pageSize | Integer | Specifies the number of results per page. It allows for control over the volume of data returned in a single API call. | 50 |
Making a Paginated Request
Example Request:
curl --location 'https://embedded.runalloy.com/2024-03/one/commerce/customers?credentialId=YOUR_CREDENTIAL_ID&pageNumber=2&pageSize=30
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Accept: application/json'
This request would return the second page of results, with 30 items on the page.
Understanding the Response
The response to a paginated request will typically include the requested data. This might look like the following:
{
"customers": [
{...},
{...},
{...},
]
}
Navigating Between Pages
To navigate through the pages, adjust the pageNumber
parameter in your subsequent requests.
Wrapping Up
In this article, we took a look at how to paginate through requests using Alloy's Unified API.