Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

In this article

You can access most objects in Scope Global node IDs help you query about specific Scope objects (users, groups, scenarios, etc.) using either the REST API or the via the Scope GraphQL API. With a recent update, you can find the global node ID of many objects from within

You can get global node IDs from the REST API and use these IDs in your GraphQL operations, and vice versa.Note: In /or webhooks.

In REST, the global node ID field is named node_id, and in webhooks, the global node ID field is named resource_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."

In this article

Table of Contents

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, receive a webhook that supplies an a resource_id for an object, or execute a GraphQL query that returns the an id for an object.

  2. Find the object's type in the GraphQL reference docs.

  3. Use the ID and type to do a direct node lookup in GraphQL.

...

1. Execute a GraphQL query that returns an id for an object

While Exploring the Graph, execute the following query

Code Block
query {
  viewer {
 	   organization {
      groups {
        nodes {
          id
        }
      }
    }
  }
}

...

This type of query is the standard approach for looking up an object by its global node ID.

Using global node IDs in migrations

When building integrations that use either the REST API or the GraphQL API, it's best practice to persist the global node ID so you can easily reference objects across API versions. For more information on handling the transition between REST and GraphQL, see "Migrating from REST to GraphQL."