Insights

How To Set-Up Sitecore GraphQL

Learn How To Get Started With Sitecore GraphQL

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.

Setting Up Sitecore GraphQL

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.

Sitecore.Services.GraphQL.Content.Master.config master node

Accessing Your GraphQL Endpoint

To access your GraphQL endpoint head to http:///sitecore/api/graph/items/master/ui you can use this GUI to compose queries and see what data is being returned.

Sitecore Experience Graph Browser

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 } } } }

Documentation

If you need some guidance on how to build your queries, the Sitecore GraphQL UI has some built-in documentation on the side.

Sitecore Experience Graph Browser

Documentation Explorer in Sitecore Experience Graph Browser

Closing

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.

👋 Hey Sitecore Enthusiasts!

Sign up to our bi-weekly newsletter for a bite-sized curation of valuable insight from the Sitecore community.

What’s in it for you?

  • Stay up-to-date with the latest Sitecore news
  • New to Sitecore? Learn tips and tricks to help you navigate this powerful tool
  • Sitecore pro? Expand your skill set and discover troubleshooting tips
  • Browse open careers and opportunities
  • Get a chance to be featured in upcoming editions
  • Learn our secret handshake
  • And more!
Sitecore Snack a newsletter by Fishtank Consulting