Meet us at Sitecore Symposium 2024 and Discover New Ways to Enhance Your Dynamics Experience. Book a Meeting
Through this blog, you will understand how to set up and use the Sitecore GraphQL API. You get the GraphQL API by installing the JSS server components package. In the Sitecore Headless Service 16.0 and later versions, the Edge Preview endpoint is kept enabled by default but you can also configure additional endpoints. Follow the below steps for that.
After that, you initialize the hosting class as it is described below:
After that is done, we have to create the schema class based on SchemaProviderbase. We also have to inherit the SchemaProvideBase class and create a new class as per the requirements.
In the above given method (Find blog) we write our own custom logic.
My class ISCQuery that is required is in the below model but you can create the model as per your requirements.
After this, we are all set for using the new GraphQL endpoint with the custom schema as per the requirements.
To get access to the new GraphQL enpoint, please type (https://domain+your_new_endpoint_url+/ui)
In our case, it is (https://domain+/api/graph/isc/ui)
After this, enter the sc_apikey in the https header and you will be able to see the window given below
On the left side of your editor, you can write queries also for example:
This is how we can create a new GraphQL endpoint usisng the query in Sitecore JSS.
Unlock 40 hour of
free consultation with
our top experts now!