Last update: 
18/8/2025

Division into pages (pagination)

  • 1
  • 2
  • 3
  • 4
  • 5

The concept is based on connections and edges, which are a quasi-standard for pagination in GraphQL. For queries that allow pagination, the arguments can First and After as well as a requested PageInfo be defined. The first argument defines how many items should be returned with the request. For performance reasons, this value must not exceed 50. Die PageInfo contains a EndCursorwho the cursor Defined the last element on the page. This EndCursor Can then for the Afterargument of the next request can be used to add the following elements after EndCursor to receive. The parameters for controlling page numbering are documented in the diagram.

For the first page, no Afterargument can be set. The following query returns the first 50 entries along with a PageInfo Back that the EndCursor the page contains.

{
    allEntries(first: 50) {
        totalCount
        pageInfo {
            hasNextPage
            endCursor
        }
        edges {
            node {
                id
                name
            }
        }
    }
}

To request the next 50 entries, we use the EndCursor the previous answer and set it as follows for the after argument of the next request:

{
    allEntries(first: 50, after: "NTA") {
        totalCount
        pageInfo {
            hasNextPage
            endCursor
        }
        edges {
            node {
                id
                name
            }
        }
    }
}