Experience Edge APIs

Experience Edge APIs let you retrieve Sitecore content and administer your Experience Edge environment. Here's an overview of the available APIs:

APIDescription
Preview GraphQL APIRetrieve both unpublished and published Sitecore content from the content management instance.
Delivery GraphQL APIRetrieve only published Sitecore content from Experience Edge.
Admin REST APIManage Experience Edge configuration and webhooks.
Token REST APIProgrammatically manage Delivery GraphQL API tokens.

The following sections describe when to use each API.

APIs for retrieving Sitecore content

SitecoreAI content authors use the Page builder to create, manage, and publish content. To retrieve that content and render it in front-end applications, developers use one of two GraphQL APIs, depending on how much content they want to retrieve:

  • Use the Preview GraphQL API to retrieve all content, including unpublished (draft) and published content. This API is typically used for local development and in your app's non-production (testing and staging) environments. In these environments, content authors can preview their drafts, and developers can build and test the front end that includes the draft content before publishing. Behind the scenes, all Sitecore content is stored in your content management instance, which exposes this API.
  • Use the Delivery GraphQL API to retrieve only published content. This API is typically used in your app's production environment where draft content should not be available. Behind the scenes, published content is served from Experience Edge, which exposes this API. Experience Edge is a globally distributed, high-performance content delivery layer. It serves static, cached content, making it highly efficient.
Note

The Preview GraphQL API is exposed by your content management instance, not by Experience Edge, but it's discussed with the Delivery GraphQL API because you use both for retrieving Sitecore content.

Although the Preview GraphQL API and the Delivery GraphQL API return different content, they use the same authorization methods and share the same query and response shape. Note that some differences exist.

Both GraphQL APIs are read-only. To be able to both retrieve and modify Sitecore content, use the Authoring and management GraphQL API instead.

API for administering Experience Edge

Use the Admin REST API to administer your Experience Edge environment, where your published content is served. These admin tasks are not applicable to unpublished content, which is served from your content management instance.

The Admin REST API serves two primary functions:

  • Manage Experience Edge settings - retrieve and update the configuration of your Experience Edge environment, clear the entire Experience Edge cache for your published content, delete published content from Experience Edge, and update time to live (TTL). TTL is the maximum duration that content and media items are retained in the Experience Edge cache.
  • Manage webhooks - webhooks enable you to receive notifications regarding changes to your published content. For example, you can set up webhook notifications to automatically trigger static site generation every time new content is published to Experience Edge.

API for managing tokens

Use the Token REST API to programmatically create, list, rename, and revoke Delivery GraphQL API tokens.

Note that you don't have to use the Token REST API to access the Delivery GraphQL API. Instead, you can use the credentials available in SitecoreAI Deploy.

The Token REST API cannot be used to manage tokens for the Preview GraphQL API.

If you have suggestions for improving this article, let us know!