Setup Pagination
How to Setup Pagination Inside Custom API Connector of Superjoin
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:
Field | Required | Description |
---|---|---|
Offset should be set through | yes | Choose 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 name | yes | Define 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:
Field | Required | Description |
---|---|---|
Page number should be set through | yes | Choose 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 name | yes | Define the exact parameter name that will carry the page number in your API request, such as page or page_number. |
Starting page number | yes | Specify 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:
Field | Required | Description |
---|---|---|
Path | yes | Define the JSON path in the API response where the cursor is located, such as data.nextCursor. |
Property | yes | Specify the name of the field that will hold the cursor value in your API request, typically labeled as cursor or a similar identifier. |
Injection Into | yes | Choose 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:
Root Level: Used when data is directly accessible at the top level of the JSON response. For example: