APIs usually retrieve one page of data at a time. Configuring pagination allows automations to fetch more than just a single page.
The kinds of pagination supported varies according to each API, refer to their documentation for more details.
Let’s go over how to configure these settings in Sheetgo.
Types of pagination
Different APIs use specific pagination methods depending on the nature of their data and how it is structured.
Sheetgo supports 6 types of pagination:
Cursor
Used when the API returns a token (cursor) for fetching the next set of data. Common in modern APIs.
Parameters:
type: "cursor": Defines pagination type.
cursor_param: Query parameter used to pass the cursor token.
has_more_key: Boolean response key to indicate if more pages are available.
next_cursor_key: Key in the response containing the next cursor token.
"pagination": {
"type": "cursor",
"cursor_param": "pageToken",
"has_more_key": "hasMore",
"next_cursor_key": "nextPageToken",
}
Page
Used when APIs require specific page numbers and page sizes in the query.
Parameters:
type: "page".
page_param: Query parameter for the current page number.
per_page_param: Query parameter for how many items to return per page.
"pagination": {
"type": "page",
"page_param": "page",
"per_page_param": "pageSize"
}
Offset
Used to skip a specific number of items and define how many to return. Suitable for simple datasets.
Parameters:
type: "offset".
offset_param: Query parameter for the number of items to skip.
limit_param: Query parameter for how many items to return.
"pagination": {
"type": "offset",
"offset_param": "offset",
"limit_param": "limit"
}
Query offset
Similar to offset, but used in APIs that accept a query string with embedded limits and offsets.
Parameters:
type: "query-offset".
query_key: The query parameter used to send the full query string.
query_offset_key: Key to define where to start.
query_limit_key: Key to define how many items to return.
"pagination": {
"type": "query-offset",
"query_offset_key": "STARTPOSITION",
"query_limit_key": "MAXRESULTS",
“query_key”: “query”
}
Link
Used when the API includes a next link in the response body that points to the next page.
Parameters:
type: "link".
next_link_key: JSON key path to find the URL for the next request.
"pagination": {
"type": "link",
"next_link_key": "info.next"
}
Header link
Used when the next page URL is provided in the response headers.
Parameters:
type: "header-link".
next_link_key: Header key that contains the next page link.
"pagination": {
"type": "header-link",
"next_link_key": "Link"
}