This version of GitHub Enterprise was discontinued on 2021-06-09. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise. For help with the upgrade, contact GitHub Enterprise support.

Using global node IDs

You can get global node IDs of objects via the REST API and use them in GraphQL operations.

You can access most objects in GitHub (users, issues, pull requests, etc.) using either the REST API or the GraphQL API. With a recent update, you can find the global node ID of many objects from within the REST API and use these IDs in your GraphQL operations.

Note: In REST, the global node ID field is named node_id. In GraphQL, it's an id field on the node interface. For a refresher on what "node" means in GraphQL, see "Introduction to GraphQL."

Putting global node IDs to use

You can follow three steps to use global node IDs effectively:

  1. Call a REST endpoint that returns an object's node_id.
  2. Find the object's type in GraphQL.
  3. Use the ID and type to do a direct node lookup in GraphQL.

Let's walk through an example.

1. Call a REST endpoint that returns an object's node ID

If you request the authenticated user:

$ curl -i -u username:token http(s)://[hostname]/api/v3/user

you'll get a response that includes the node_id of the authenticated user:

{