Pagination

One Record API implements pagination to efficiently manage and navigate through large datasets, ensuring a smooth and scalable experience. Pagination allows applications to fetch subsets of records, making data retrieval more manageable and reducing server load. This document outlines the use of page[cursor] and page[limit] parameters for pagination in the API requests.

Understanding Pagination Parameters

page[limit]

This parameter specifies the maximum number of records to return in a single request.

The maximum allowable limit is set to 200 items.

Requests attempting to exceed this limit will be automatically adjusted to the maximum allowable value.

page[cursor]

This parameter is used to navigate through the records by providing a reference cursor from which the next set of records should be retrieved.

Data Retrieval Process

An initial request might not include a cursor parameter, indicating that it is at the beginning of the dataset. The response will include a cursor in the metadata object's next value. This cursor should be used in subsequent requests to continue retrieving data efficiently. Once last page reached, the next value will be null.

How to Use Pagination

  • First Request: the first request is sent without specifying a page[cursor]parameter. The page[limit] can be set to retrieve a number of records per page, up to a maximum of 200.

  • Subsequent Requests: the next cursor received in the previous response metadata is used to make the next request. It is included in the page[cursor] parameter to fetch the next set of data.

Example Request without Cursor

GET /<resource>?page[limit]=100

This request fetches the first 100 records based on page[limit] parameter. The response will include a cursor in the metadata.next value for fetching the next 100 records.

Example Request with Cursor

GET /<resource>?page[limit]=100&page[cursor]=<cursor_value>

Following the initial request, the subsequent 100 records can be retrieved by utilizing both the page[limit] parameter and the page[cursor] parameter with the value of metadata.next obtained from the previous response. Once the last page is reached, the value of next in metadata will be null.

Last updated