Repository Global ID

community-help

#1

I am trying to query all of the names of the repositories that my organization has, but I keep receiving the error "INVALID_CURSOR_ARGUMENTS when using a repository’s id in the after: field.

Is there another id that I should be using there?

Query:

query{
  organization(login:"organization-here") {
    repositories(first:100, after: "repository-id-here", orderBy: {field:NAME, direction:ASC}) {
      nodes {
        name
      }
    }
  }
}

#2

Is there another id that I should be using there?

Yes, you should use the cursor from your last query, not the respository ID.

See https://developer.github.com/v4/reference/object/pageinfo/ and its endCursor field. Also see http://graphql.org/learn/pagination/.

You can also read the pagination section of githubql README, but keep in mind that’s written in context of learning how to do pagination using the Go package.


#3

Great, thank you @shurcooL! That helped me solve my problem.