In this blog post, we will go through the features of Sitecore GraphQL Browser. Please note this is mostly for development work, refer to the official Sitecore documentation when setting up for production.
Head into the web.config of your Site and set <compilation debug="true">
. This should be disabled in Production scenarios, but since we're just using it for development, it's fine.
Open up Sitecore.Services.GraphQL.Content.Master
and make note of the API url under the 'master' node.
To access your GraphQL endpoint head to http://
you can use this GUI to compose queries and see what data is being returned.
Below is an example query that you can use to scan every Sitecore item under a certain node, looking for a specific template.
{
search(keyword: "", rootItem: "/sitecore/content/Home", fieldsEqual: [{name: "_templatename", value: "Content Page"}]) {
results {
totalCount
items {
name
}
}
}
}
If you need some guidance on how to build your queries, the Sitecore GraphQL UI has some built-in documentation on the side.
This is just the basics on how to get started using Sitecore GraphQL. You can also run these queries through other Platforms, such as Postman.
Thank you for reading, and I hope to cover how to run these queries in more detail in future blog posts.
Sign up to our bi-weekly newsletter for a bite-sized curation of valuable insight from the Sitecore community.