Pagination helps manage large datasets by breaking them into smaller, manageable chunks. This guide explains how to implement cursor-based pagination using Rize GraphQL API.
hasNextPage
: Indicates if there are more pages to fetch.hasPreviousPage
: Indicates if there are previous pages to fetch.startCursor
and endCursor
: Markers for the beginning and end of the current page.query Projects($first: Int, $after: String) {
projects(first: $first, after: $after) {
edges {
node {
id
name
}
cursor
}
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
}
}
Variables:
{
"first": 2,
"after": nul
}
Sample Response:
{
"data": {
"projects": {
"edges": [
{
"node": {
"id": "1123124126",
"name": "Project ABC"
},
"cursor": "MQ"
},
{
"node": {
"id": "12434423422125",
"name": "Project XYZ1"
},
"cursor": "Mg"
}
],
"pageInfo": {
"hasNextPage": true,
"hasPreviousPage": false,
"startCursor": "MQ",
"endCursor": "Mg"
}
}
}
}
Use the endCursor
from the previous response as the after
parameter:
{
"first": 2,
"after": "Mg"
}