- GraphQL APIs
Differences between the Preview and the Delivery GraphQL APIs
Although the Preview GraphQL API and the Delivery GraphQL API use the same authorization methods and share the same query and response shape, some differences exist between the two APIs. This topic describes the differences between the two APIs.
Query complexity
Query complexity is calculated differently between the APIs. In practice, a query that runs on the Preview GraphQL API endpoint should also run on the Delivery endpoint, but you should test both endpoints if the query is large or deeply nested.
Schema and field differences
Due to differences in the fields available between unpublished and published content, we recommend you use the fields described in the Experience Edge schema documentation when querying published content available in Experience Edge. In addition, for any fields you might have added, make the fields from the standard template publishable.
Note the following schema differences:
- Field availability can differ:
- Preview - can expose fields not available in published content.
- Delivery - only exposes fields documented in the Experience Edge schema plus any standard-template fields you explicitly publish.
- The
_latestversionsearch field behaves differently:- Preview - the field returns the latest available version and allows
falseto return all versions. - Delivery - the field returns the latest publishable version and only accepts
true.
- Preview - the field returns the latest available version and allows
Schema extension
The Preview GraphQL API schema mirrors the schema of the Delivery GraphQL API. The Preview GraphQL API schema is not extensible because it must remain compatible with Experience Edge.
Caching and rate limiting
- Preview - the content served via the Preview GraphQL API is not cached, so it is not expected to be fast under repeated load. Avoid heavy load because it can affect overall SitecoreAI instance performance.
- Delivery - the content served via the Delivery GraphQL API is cached, so identical queries should perform faster. The API is rate limited to 80 requests per second.
Links
Links can differ because Preview resolves links in the authoring context (including site virtual folders and preview hostnames), while Delivery resolves links in the published context (canonical public routes).
Media links in rich text
-
Preview - use the
Private Linkfield of theXMC Hybrid Mediaitem.XM Cloud is now SitecoreAISome code examples, images, and UI labels may still use XM Cloud while engineering assets are being updated.
-
Delivery - use the
Public Linkfield.
Item links in LinkField
LinkFieldConsider a GraphQL query that reads a specific LinkField from an item and returns the resolved link URL:
Compare how the link URL is resolved in Preview and in Delivery:
-
Preview - the link can include a virtual folder segment:
json -
Delivery - the link uses the published route path without the virtual folder segment:
json
Item URLs
Consider a GraphQL query that reads the Item.url object for an item:
Compare how url and path are resolved in Preview and in Delivery:
-
Preview - the URL and path reflect the authoring host and virtual folder:
json -
Delivery - the URL and path reflect the published site host and route:
json