...
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: "User") { 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.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 isPOST
, whether it's a query or a mutation.
In addition to manually executing introspection queries manually, most GraphQL client tools include features that can help you navigate the schema in real time as you design queries and mutations. The image below shows one such tool, GraphiQL, with auto-completion (left panel) and embedded documentation (right panel). See “Exploring The Graph”.
...