GraphQL cursor pagination method
Overview
GraphQL cursor pagination is a method for paginating GraphQL APIs.
Here, we send a GraphQL query requesting a list of items. This query includes parameters such as the number of items to fetch and any filtering or sorting criteria required. In response, requested items are received, together with cursor information (each item in the response is associated with a cursor, which is typically a unique identifier for that item).
The GraphQL cursor pagination method was developed for the Shopify GraphQL API however, the same principles apply for other GraphQL systems.
GraphQL cursor options
Option | Summary |
---|---|
EndCursor path | Always defined in the following form:
|
HasNextPage path | Always defined in the following form:
|
GraphQL cursor pagination - endpoint body requirements
The GraphQL cursor pagination method works in conjunction with a query on the endpoint body, which determines required settings. For example:
If you need to change the existing query for an endpoint, you should edit the connector and access body options for the required endpoint.
When does pagination stop?
Pagination continues until hasNextPage
is returned as false
.
Last updated