Paginate Results
AVAILABLE API VERSION |
---|
API v56.0 and later |
GraphQL API returns the first 10 results of a query by default. Based on the GraphQL Cursor Connections Specification, the Connection object contains the returned object and the node
(account, for example), totalCount
, and resultPageCount
objects. Additionally, the pageInfo
object contains cursor information and if there are more results to return.
Within the RecordQuery
type, each field is a Relay Record Connection type. Connections enable paging through the result set with ease. Connections are made up of four types:
Connection
: The root object for the paged collection, which ties together the result set with thePageInfo
type. TheConnection
type is specific to the type of resource being paged, for example when paging throughAccount
objects theConnection
type isAccountConnection
.Edge
: Ties together the actual record result type, for exampleAccount
. Includes a cursor that points to the specific location in the result set and theNode
type.Node
: The actual resource being paged.PageInfo
: Contains relative position information, which shows where in the entire result set the current page is located. ThePageInfo
type is the same for everyConnection
type.
Use pagination several ways.
- Paginate using an upper-bound limit. Available in API version 59.0 and later.
- Paginate by switching from relay record pagination to upper-bound limit pagination. Available in API version 60.0 and later.
- Paginate using GraphQL relay record connections.