To view this content in our official product documentation, click here.
Overview
GraphQL cursor pagination is a method for paginating GraphQL APIs. In this context, a 'cursor' is a pointer that represents a specific position in the data set. Instead of saying "return page 3", you say "return 10 items after this cursor".
You can find more information about how this pagination method works in Shopify's API documentation.
The GraphQL cursor pagination method was developed for the Shopify GraphQL API; however, the same principles apply to other GraphQL systems.
GraphQL cursor options
| Option | Summary |
|---|---|
| EndCursor path |
The expected location of the pointer (i.e. the cursor) for the last item returned in the current page of results. When the next page is requested, the
The
|
| HasNextPage path |
The expected location of the
The
|
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:
{"query":"{products(first: 250, ) {edges { node { id title } } pageInfo { hasNextPage startCursor endCursor }}}","variables":{}}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.
Comments
0 comments
Please sign in to leave a comment.