Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

GraphQL Pagination

Ghislain B edited this page Oct 16, 2017 · 15 revisions

With cursor

With cursor, the query can have 4 arguments:

  • first: integer representing how many rows of data to get from the start of dataset
  • after: pull data starting at cursor "x", where "x" is the last item cursor
  • last: integer representing how many rows of data to get from the end of dataset
  • before: pull data before a cursor "x", where "x" is the last item cursor

For example

  users (first:20, after:"YXJyYXljb25uZWN0aW9uOjM=") {
    totalCount
    pageInfo {
      hasNextPage
      endCursor
    }
    edges {
      cursor
      node {
        name
        gender
      }
    }
  }

Without cursor

Without cursor, the query can have 3 arguments:

  • first: integer representing how many rows of data to get from the start of dataset
  • last: integer representing how many rows of data to get from the end of dataset
  • offset: integer representing how many to skip

For example

  users (first:20, offset: 10) {
    totalCount
    pageInfo {
      hasNextPage
    }
    nodes {
      name
      gender
    }
  }

Contents

Clone this wiki locally