Pagination is an essential feature in API integration, allowing you to handle large datasets by breaking them into smaller, more manageable parts. This approach ensures efficient data processing and prevents overloading both the API and your application with excessive data at once.

In Superjoin’s Custom API, we support three types of pagination: offset-based pagination, cursor-based pagination, and page-based pagination. These methods enable incremental data retrieval without loading everything at once and can be configured under the data preview section.

Configuring Offset Based Pagination

When setting up offset-based pagination in Superjoin’s Custom API, you’ll encounter a few specific fields that help define how data is fetched in segmented ways.

Here’s a simplified explanation of each field to help you understand and configure pagination efficiently, even if you’re not deeply familiar with API mechanics:

FieldRequiredDescription
Offset should be set throughyesChoose where the offset value will be included in your API request. You can insert it in the query parameters, headers, or body of the request.
Offset should be set as the property nameyesDefine the exact parameter name that will carry the offset in your API request, such as offset, start, or skip.

Configuring Page Based Pagination

Page-based pagination is a straightforward approach, perfect for scenarios where users need to access specific pages directly. This method divides data into pages, making navigation intuitive and user-friendly.

Here’s a simplified explanation of each field to help you understand and configure pagination efficiently, even if you’re not deeply familiar with API mechanics:

FieldRequiredDescription
Page number should be set throughyesChoose where the page number will be included in your API request. It can be placed in the query parameters, headers, or body of the request.
Page number should be set with the nameyesDefine the exact parameter name that will carry the page number in your API request, such as page or page_number.
Starting page numberyesSpecify the starting page number for pagination, typically set to 0 or 1, depending on your system’s requirements.

Configuring Cursor Based Pagination

Page-based pagination is a straightforward approach, perfect for scenarios where users need to access specific pages directly. This method divides data into pages, making navigation intuitive and user-friendly.

Here’s how to configure page-based pagination with the relevant fields:

FieldRequiredDescription
PathyesDefine the JSON path in the API response where the cursor is located, such as data.nextCursor.
PropertyyesSpecify the name of the field that will hold the cursor value in your API request, typically labeled as cursor or a similar identifier.
Injection IntoyesChoose where to inject the cursor value in the API request. Options include placing it in the query parameters, headers, or body of the request.

Understanding Path Levels:

Nested Level: Used when data is organized within multiple layers in the JSON response.

For example:

{
  "data": {
    "pagination": {
      "next_cursor": ""
    }
  }
}

Root Level: Used when data is directly accessible at the top level of the JSON response. For example:

{
  "next_cursor": ""
}