Discovering Schema Information
Using Introspection
Query the below field
Probing for Introspection
If introspection is enabled, the response returns the names of all available queries.
Running a Full Introspection Query
The example query below returns full details on all queries, mutations, subscriptions, types, and fragments.
Note
If introspection is enabled but the above query doesn't run, try removing the onOperation
, onFragment
, and onField
directives from the query structure. Many endpoints do not accept these directives as part of an introspection query, and you can often have more success with introspection by removing them.
Visualizing Introsepection Results
This is an online tool that takes the results of an introspection query and produces a visual representation of the returned data, including the relationships between operations and types.
Suggestions
Even if introspection is entirely disabled, you can sometimes use suggestions to glean information on an API's structure.
Suggestions are a feature of the Apollo GraphQL platform in which the server can suggest query amendments in error messages.
These are generally used where a query is slightly incorrect but still recognizable (for example, There is no entry for 'productInfo'. Did you mean 'productInformation' instead?
).
You can potentially glean useful information from this, as the response is effectively giving away valid parts of the schema.
Clairvoyance is a tool that uses suggestions to automatically recover all or part of a GraphQL schema, even when introspection is disabled. This makes it significantly less time consuming to piece together information from suggestion responses.
You cannot disable suggestions directly in Apollo. See this GitHub thread for a workaround.
Last updated