Notifications

124 views

Description

Description


This article wil outline steps to follow in order to connect GraphiQL (An in-browser IDE for exploring GraphQL) to your London instance. 

Procedure


There are 3 pieces of info required to achieve this:

  1. An Endpoint
  2. A user token for authentication
  3. A cookie (or rather the contents of a certain cookie)

The endpoint you can get by following this syntax: https://<instance-name>.service-now.com/api/now/graphql

The User token and cookie can be gathered using Chrome DevTools. Follow these steps:

  1. HOP onto a London instance with Agent Workspace enables as a Maint user
  2. Open Agent Workspace
  3. Open Chrome DevTools for the page you have Workspace on
  4. In DevTools, go to the Network tab
  5. In Workspace, open an Incident record
  6. Back in Devtools, look towards the bottom of the requests list (the latest) for one titled "graphql". Open it
  7. Open the Headers tab and scroll down to the "Request Headers" section
  8. Get the "x_usertoken" and "Cookie" values


Now open GraphiQL and put your endpoint into the text box at the top

Make sure the Method is set to POST. Open "Edit HTTP Headers"

Create the Headers in the screenshot below with the values retrieved from DevTools. Also, add a "Connection" header and set it to "keep-alive"

Save the values and close the Headers menu. GraphiQL should now automatically connect to your instance (may take about 15 seconds to load due to the Documentation Explorer)

Applicable Versions


London

Additional Information


- The User token and Cookie are new for every session. You will need to get the new values from DevTools and add them to GraphiQL every time you start a new session (i.e. when you logout or your session times out)

- This method only works for Maint users as is. If you try this as an Admin you will receive the following error message

"errorType": "IllegalAccess",
"message": "Introspection queries require that glide.graphql.introspection_enabled is true or this is a user has the maint role."

As the message suggests, create a new system property called glide.graphql.introspection_enabled, Type is True/False, and the value is True. Then you should be able to connect as Admin

Article Information

Last Updated:2020-06-25 11:50:42
Published:2020-06-25