Skip to content

graphiql

Peter Holloway edited this page Apr 24, 2025 · 1 revision

Graphiql

The service provides a graphiql front-end (at /graphiql) that gives an IDE like experience for writing queries and mutations with autocompletion and syntax highlighting. It also provides access to the schema and docs for various types and fields.

This endpoint is also linked from the default homepage when accessing numtracker from a browser.

Using authentication with graphiql

When the service is configured to use authn/authz, you will need to pass an access token as part of the Authorization header in the request. In graphiql, this can be done by adding it in JSON format in the Headers tab below the editor.

{"Authorization": "Bearer <ACCESS_TOKEN>"}

where <ACCESS_TOKEN> is your token retrieved from the oauth service.

Requesting an access token

kubectl oidc-login get-token\
        --oidc-issuer-url=https://authn.diamond.ac.uk/realms/master\
        --oidc-client-id=qan22331\
        --grant-type=password\
        --oidc-use-access-token | jq -r '.status.token'

This will give you an access token that can be used in numtracker. Note that these tokens are fairly short lived and will need to be refreshed roughly every minute. It can be easier to use an alternative interface for repeated testing.

At diamond, this may require module load argus to make kubectl work. You may be prompted for username and password the first time it is run.

jq is a json query tool. It is useful but without it the token is still available from the JSON returned from the above command.

Clone this wiki locally