Versions Compared

Key

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

...

  • Query __schema to list all types defined in the schema and get details about each:

    Code Block
    query {
    __schema {
      types {
        name
        kind
        description
        fields {
          name
        }
      }
    }
    }
    
  • Query __type to get details about any type:

    Code Block
    query {
    __type(name: "Repository") {
      name
      kind
      description
      fields {
        name
      }
    }
    }
    
  • You can also run an introspection query of the schema via a GET request:

    Code Block
    $ curl -H "Authorization: Token token" https://cms.scopear.com/api/v3/graphql

    The results are in JSON, so we recommend pretty-printing them for easier reading and searching. You can use a command-line tool like jq or pipe the results into python -m json.tool for this purpose.

    Alternatively, you can pass the idl media type to return the results in IDL format, which is a condensed version of the schema:

    Code Block
    $ curl -H "Authorization: bearer token" -H "Accept: application/vnd.Scope.v4.idl" \
    https://api.Scope.com/graphql

    Note: The introspection query is probably the only GET request you'll run in GraphQL. If you're passing a body, the GraphQL request method is POST, whether it's a query or a mutation.

...