Pagination
Make sure to include pagination parameters in queries to avoid network time out errors
For any query that returns a list of results, we highly recommend using pagination. If pagination is not applied, it is much more likely that a network timeout error (in the form of a 502 error) will be returned. This occurs when an API call doesn't receive a response for 30 seconds. Pagination allows you to return a smaller data payload by returning a subset of the results to avoid the timeout error. It subsequently gives you a way to query further results as needed.
We use a cursor pagination pattern for our GraphQL API. See more info on GraphQL pagination here.
Example
In this example, the parts query grabs the first five parts by utilizing the first
parameter and fetch the endCursor
in the pageInfo
object as shown in the request as shown below.
Example Response
In addition to first
, ION queries have pagination parameters of last
, before
, and after
.
In this next example, this parts query returns the next five 5 parts after the part identified by the endCursor
from the previous query. If all parts in ION were to be queried, this pattern can be used to fetch all parts in batches of 5. In addition, use the hasNextPage
to determine if there are more results remaining after this query.
Last updated