Search code examples
graphqlgithub-apigithub-graphql

Display more than 100 entries through GraphQL API


I have tired pagination using endCursor and hasNextPage in github grpahQL API to get more than 100 data. Query I used is:

query {
      organization(login:"XXX") {
                   repository(name:"XX") {
                   pullRequests(first:100, states:[OPEN], after: "XXX" ) {
        pageInfo{
          hasNextPage
          endCursor
        }
      }
    }

It is working. But in order to access further details,iterative pagination needs to be done. Can anyone provides an efficient alternative to traverse all pages programatically in GraphQL API?


Solution

  • Pagination using endCursor is the one solution. Like REST API, you cannot traverse all pages pragmatically. As you specified you can specify endCursor and traverse if there is next page