Versions Compared

Key

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

You can run queries on real Scope data using any HTTP compliant client (HTTP Client) or GraphQL integrated development environment (GraphQL IDE). GraphQL IDEs are typically easier to work with because they include docs, syntax highlighting, and validation errors.

...

Scope GraphQL Explorer is an instance of GraphiQL (a GraphQL IDE) that is available in-browser at https://cms.scopear.com/api/v3/graphql/explorer.

Note

Note: Scope has temporarily disabled the Explorer

...

, but you can still

...

explore the graph using a local GraphiQL client, or any other

...

similar client (see below).

Using GraphiQL

To use the GraphiQL app, download and install it from https://www.electronjs.org/apps/graphiql.

...

Code Block
query {
  viewer {
    name
  }
}

If everything worked correctly, this will display the name of the currently authenticated user. You're all set to start making queries.

...

Code Block
query($my_custom_node_id_var:String!){
  node(id: $my_custom_node_id_var:String) {
    __typename
   }
}
variables {
   "my_custom_node_id_var:String": "6_kJ_XUGDxMDWkwq2bAK-dKknUQ7GPpsI2yfj691f9L2n6N4sAhdU4urWqNG1RVX"
}

This is the correct format to submit the call via a cURL POST (as long as you escape newlines).

...

Code Block
{
   "my_custom_node_id_var:String": "6_kJ_XUGDxMDWkwq2bAK-dKknUQ7GPpsI2yfj691f9L2n6N4sAhdU4urWqNG1RVX"
}

Troubleshooting errors

Because GraphQL is introspective, the Explorer supports:

...

Code Block
{
  "data": null,
  "errors": [
    {
      "message": "Objects must have selections (field 'nodes' returns User but has no selections)",
      "locations": [
        {
          "line": 5,
          "column": 8
        }
      ]
    }
  ]
}

It's possible you might run into an unexpected error that is not related to the schema. If this happens, the message will include a reference code you can use when reporting the issue:

Code Block
{
  "data": null,
  "errors": [
    {
      "message": "Something went wrong while executing your query. This is most likely a Scope bug. Please include \"7571:3FF6:552G94B:69F45B7:5913BBEQ\" when reporting this issue."
    }
  ]
}

Note: Scope recommends checking for errors before using data in a production environment. In GraphQL, failure is not total: portions of GraphQL queries may succeed while others fail.

...

You must obtain a valid OAuth token before attempting to execute queries against, or explore the schema of, the Scope API.

There are two kinds of OAuth tokens:

  1. “Permanent” API tokens that never expire.

  2. “Temporary” Session based tokens that expire after a relatively short period of time, or “sign-out”.

To obtain

...

a permanent API token:

Contact support and request a Scope Admin create and enable an API token for your organization.

To obtain a temporary session token:

  1. Use your favorite HTTP client to sign in:

    Code Block
    curl --request POST \
      --url https://cms.scopear.com/api/v2/users/sign_in.json \
      --header 'Content-Type: application/x-www-form-urlencoded' \
      --data 'user[username]=YOUR_EMAIL' \
      --data 'user[password]=YOUR_PASSWORD'

  2. Parse the response as JSON and extract the value for the auth_token key (e.g. the following response should yield the following token):

    Code Block
    {
      "id": 1,
      "email": "support@scopear.com",
      "name": "Support Account",
      "permalink": "supportscopearcom",
      "username": "support@scopear.com",
      "guest": false,
      "auth_token": "eyJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7InVzZXJfaWQiOjEsImRldmljZV9pZCI6MX0sImV4cCI6MTYwODI0NDA3MSwianRpIjoiOGY3ODg1NTg2Y2Y4YTdiNjQ1MWIwZTcxMzFhODY1MDE2MmQwZWZhZjc3MTgwYTNhZmU5OTk2N2Y4OTZhNzlhOCIsImlhdCI6MTYwNTY1MjA3MX0.Z4hFOmLlUPolvW3u-2Ssn7LWX_c2y95a1fhID3QJuCg",
      ...

    => eyJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7InVzZXJfaWQiOjEsImRldmljZV9pZCI6MX0sImV4cCI6MTYwODI0NDA3MSwianRpIjoiOGY3ODg1NTg2Y2Y4YTdiNjQ1MWIwZTcxMzFhODY1MDE2MmQwZWZhZjc3MTgwYTNhZmU5OTk2N2Y4OTZhNzlhOCIsImlhdCI6MTYwNTY1MjA3MX0.Z4hFOmLlUPolvW3u-2Ssn7LWX_c2y95a1fhID3QJuCg

...