Pagination
Queries return up to 30 results unless you specify a different limit (page size) with the first
parameter.
When there are many records in the results, applications should retrieve "pages" of results instead of all results. For example, retrieve the first 200 results, then retrieve the next 200 results, until done. Such pagination improves performance and makes the results manageable.
totalCount
value is always the count of all records that matched the filter, regardless of page size.Queries that perform pagination have this basic structure:
Where:
-
filter
identifies the records to retrieve. -
after
is a cursor that identifies where to start the page. For the initial query, the value isnull
, but for subsequent queries, it is an encoded string representing the "last result" at the end of the previous page, as identified by theendCursor
value. -
first
is the page size: return up to this many results. -
endCursor
is an encoded string representing the last result in the page, and is the value to use as theafter
in the next page. -
hasNextPage
is true when there are more records after the current page. -
totalCount
is the number of records that match the filter criteria.
To perform pagination,
-
Perform a query with a limited page size (
first
). -
If
hasNextPage
is true, repeat the query but change to be the value returned byendCursor
in the previous query. -
Repeat step 2 until
hasNextPage
is false.
This illustration shows pagination over a set of 246 results, where the page size is 100:
endCursor
string.Example: Pagination
To request paginated results and navigate the pages, request the pageInfo
node, and use the endCursor
and hasNextPage
values as parameters for the next call.
Example: use pagination
Example: Variables
Sample response