The GraphQL API Explorer
Every Prismic repository includes a GraphQL API explorer that will help you discover your API, test your queries, and display the JSON results. Our GraphQL explorer uses GraphiQL. Here we will go through the details on how to use this API browser.
Go to your GraphQL Explorer
The url for your repository's GraphQL Explorer will look like this:
Enter your query and see your result
The GraphQL explorer is divided into two parts: the left part lets you build a query and the right part shows the results of the query.
The GraphQL explorer offers an autocompletion feature that helps you build your query. By hitting CTRL + SPACE, you will be able to see all the options available as you construct your query.
In the example below, I create a new query to get all my blog posts using allBlogs, and query for the "title" field of the posts:
To learn more about the specifics of each query, check out our Query the API pages.
The GraphiQL editor
The GraphiQL editor that the explorer uses provides :
- Syntax highlighting
- Intelligent type ahead of fields, arguments, types and more
- Real-time error highlighting and reporting
- Automatic query completion
- The ability to run and inspect query results
History of your queries
The explorer provides you a history of your previous queries. Click on the history button to see your previous queries, and click on one of the queries to view and run the query again.
The GraphQL explorer also provides a documentation directly in the explorer of the different field types and query fields available. To access the documentation, just click on the "Docs" button or CTRL+CLICK on a field to get the parent & child types of that field.