Experience Edge for Sitecore Content Hub and GraphQL

In this blog post, I will explain the Experience Edge for Sitecore Content Hub, Experience Edge for Content Hub APIs, GraphQL IDE, and GraphQL.

Experience Edge exposes data through GraphQL APIs and media through a CDN. The CDN is responsible for routing and caching queries that flow to and from the delivery platform. Whenever Content Hub detects changes to approved content or the schema, it raises an event that triggers the automatic publishing process.

Refer to the document for more details about the Experience Edge: Experience Edge for Content Hub

To start with Experience Edge IDE, we need to first understand the Preview Vs Delivery APIs:

  • Preview API: A GraphQL API that exposes a preview of your content. This API provides access to all content, including drafts and other content that is not yet approved.
  • Delivery API: A GraphQL API that exposes your published content. This API provides access to approved and published content.

Refer to the document for more information about Content Hub APIs: Experience Edge for Content Hub APIs

Now, the next steps are to generate the API keys. To generate the API keys, go to the manage icon and select API Keys.

ee-sc-graph-ql-1

On the API Key page, click “+ API Key”, enter a name for the key, and select its purpose. Choose Preview if you want to generate a key for the Preview API or Deliver if you need it for the Deliver API, and click on Create.

ee-sc-graph-ql-2

Be sure to copy this key. You will not be able to view it again after closing this window.

Sitecore Content Hub provides the GraphQL Integrated Development Environment (IDE) that supports the GraphQL query function to develop queries. 

The following URLs you can use to open the IDE for the Preview and Delivery API:

  • Preview IDE URL: {ContentHubURL}/api/graphql/preview/ide
  • Preview Endpoints: {ContentHubURL}/api/graphql/preview/v1
  • Delivery IDE URL: https://edge.sitecorecloud.io/api/graphql/ide 
  • Delivery Endpoints: https://edge.sitecorecloud.io/api/graphql/v1  

Since I’ve generated the Preview API key, I’ll be using the Preview IDE to explain the GraphQL setup.

Copy the Preview IDE URL, replace the domain with your own Content Hub URL, and open it in your browser. Then, follow the steps shown in the image below and enter your Preview API key in the GraphQL token field.

ee-sc-graph-ql-3

To know more about the GraphQL IDE, refer to the documentation: GraphQL IDE

Write your query in the GraphQL query window on the left side, click the Execute button, and view the results on the right. To know more about GraphQL queries, refer to the documentation: GraphQL queries

ee-sc-graph-ql-4

Happy Sitecoreing ðŸ˜Š

Comments

Popular posts from this blog

Sitecore Installation Error: Failed to Start Service 'Sitecore Marketing Automation Engine'

Import CSV Data in Sitecore Using PowerShell: Part-3

Error: Method Through Reflection is Not Allowed after Applying Sitecore Hotfix