To limit the amount of data returned and ensure queries are processed quickly, most list queries are paginated.
The concept is based on connections and edges, which is effectively the standard approach to pagination in GraphQL. The pagination uses a cursor-based model with the following arguments:
first: Number of elements to return (maximum: 50)after: Cursor on the last item of the previous page (omit on the first page)Paginated queries return the following:
nodes: the actual elementspageInfo.endCursor: Cursor on the last element of the current pagepageInfo.hasNextPage: indicates whether there is another pagetotalCount: Total number of elements (where supported by the query)No after argument needs to be specified for the first page. The following query returns the first 50 entries along with a pageInfo object containing the page’s endCursor.
{
allEntries(first: 50) {
totalCount
pageInfo {
hasNextPage
endCursor
}
edges {
node {
id
name
}
}
}
}
To request the next 50 entries, use the EndCursor from the previous response and set it as follows for the After argument of the next request:
{
allEntries(first: 50, after: "NTA") {
totalCount
pageInfo {
hasNextPage
endCursor
}
edges {
node {
id
name
}
}
}
}