Pagination
Pagination in the GraphQL API
The API implements a pagination mechanism based on the standard defined by graphql.org/learn/pagination. This system allows efficient navigation through large datasets.
Pagination Parameters
Each query that supports pagination includes the following fields:
first (integer, required)
Specifies the maximum number of results to return.
The value must be between 1 and 100.
If an invalid value is provided, an error will be returned.
after(string, optional)
Specifies a starting point for retrieving data.
This cursor is a unique string generated in the previous response.
If no cursor is provided, the query starts at the beginning of the available results.
How It Works
Without
after: When theafterfield is not provided, the query returns the first available results, up to the limit defined byfirst. Example:
query {
items(first: 1) {
edges {
cursor
node {
externalId
}
}
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
}
}Typical response:
{
"data": {
"items": {
"edges": [
{
"cursor": "MjExOA==",
"node": {
"externalId": "f12145b7-b803-4d46-b0b6-28039f8624e0"
}
}
],
"pageInfo": {
"startCursor": "MjExOA==",
"endCursor": "TbFxAF==",
"hasNextPage": true,
"hasPreviousPage": false
}
}
}
}With
after: If a validaftercursor value is provided, the response will begin from the element corresponding to the cursor, including the subsequent elements up to the limit defined byfirst. Example:
query {
items(first: 10, after: "MjExOA==") {
edges {
node {
id
name
}
cursor
}
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
}
}Typical response:
{
"data": {
"getPsoRecords": {
"totalCount": 10,
"edges": [
{
"cursor": "MjExOA==",
"node": {
"externalId": "f12145b7-b803-4d46-b0b6-28039f8624e0"
}
}
...
<8 others results>
...
{
"cursor": "TbFxAF==",
"node": {
"externalId": "a3246b7-b904-3d35-c0d7-29042e8728f0"
}
}
],
"pageInfo": {
"startCursor": "MjExOA==",
"endCursor": "TbFxAF==",
"hasNextPage": false,
"hasPreviousPage": false
}
}
},
"errors": null
}Response Components
edges: A list of objects containing:node: The data for an individual item.cursor: The cursor associated with this item.pageInfo: Metadata about the pagination:startCursor: The first cursor of the current query.endCursor: The last cursor of the current query.hasNextPage: Indicates whether there are additional results beyond the current query.hasPreviousPage: Indicates whether there are additional results before the current query
Best Practices
Always save the
endCursorfrom the last response if you want to fetch the next set of data.Use a
firstvalue that suits your needs to minimize server load and improve performance.
Last updated

