Overview

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.

Key Concepts

Example Queries

Fetch the First N Items

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"
      }
    }
  }
}

Navigating Pages

Fetch the Next Page

Use the endCursor from the previous response as the after parameter:

{
  "first": 2,
  "after": "Mg"
}