At Clasp, we prioritize efficient data retrieval and manageable response sizes. To achieve this, responses that return lists of objects are paginated. This approach breaks a large dataset into smaller, more manageable chunks called pages, facilitating easier navigation through the data.

Understanding Paginated Responses

Endpoints returning lists are designed to provide responses in pages, each containing a maximum of 25 objects by default. However, Clasp allows customization of page size up to a maximum of 100 objects. A typical paginated response includes:

  • next: URL pointing to the next page of results (or null if no further pages are available).
  • previous: URL pointing to the previous page of results (or null if this is the first page).
  • results: The data objects for the current page.
{
  "next": "string | null",
  "previous": "string | null",
  "results": [array of objects]
}

To navigate through paginated data, follow the URLs provided in the next and previous fields of the response. For instance, to retrieve all entities from a paginated list, start with the initial GET request. The response will include the first page of data along with a next URL for accessing the subsequent page.

Here’s an example of accessing the first page of a list:

{
  "next": "https://sandbox.withclasp.com/members?cursor=cD0yMDI0LTAy"
}

To proceed to the next page, make a GET request using the URL in the next field. If you reach a page where next is null, you’ve accessed all available data.

Customizing Page Size

You can adjust the number of objects returned in each page through the limit query parameter, with valid values ranging from 1 to 100. If not specified, the default page size is 25.

https://sandbox.withclasp.com/members?page_size=100

This flexibility in page size allows for optimized data retrieval tailored to your application’s needs, ensuring both efficiency and scalability when accessing Clasp’s API resources.