Mastering Sitecore CMP: Delivering Content to Downstream Apps with GraphQL & REST (Part 5)

In the previous parts of this series, we focused on content modeling, custom content types, and localizing content in Sitecore CMP (Content Hub). Once content is authored and localized, the next natural question is:

How do downstream applications actually consume this content?


Sitecore CMP provides two primary integration mechanisms for content delivery:

  • REST APIs
  • GraphQL APIs

Both are powerful, but they serve different use cases. In this part, we’ll walk through how content is exposed via REST, how relationships help aggregate content, and how the same data can be consumed efficiently using GraphQL.


Content Exposure in Sitecore CMP: The Foundation

Every content item created in Sitecore CMP is:

  • An Entity
  • Based on an Entity Definition
  • Exposed consistently via APIs

For content items, the underlying definition is always M.Content, regardless of whether you’re using a default or a custom content type.

This consistency is what makes downstream consumption predictable.

Option 1: Consuming Content via REST APIs

Understanding the Entity REST Endpoint

Each entity in CMP is exposed via the standard endpoint:

https://<instance-url>/api/entities/{entityId}


For example, if a content item has an entity ID 62731, calling:

https://<instance-url>/api/entities/62731

returns a complete JSON representation of that content entity.


Sample REST Response Structure

A typical content entity response looks like this:


{ "id": 62731, "identifier": "i2cFYb6rQfyOFn4JGTHxDw", "cultures": ["en-US"], "properties": { }, "relations": { }, "created_by": { }, "created_on": "2025-12-05T20:08:09.2104718Z", "modified_by": { }, "modified_on": "2025-12-05T21:29:17.3689749Z", "entitydefinition": { }, "permissions": { }, "lifecycle": { } }


This response includes:

  • System metadata (created/modified, lifecycle, permissions)
  • Schema-level fields
  • Custom content fields
  • Relationships

Accessing Custom Content Type Fields

In this example, the content item was created using a custom content type called Generic Site Block.

Inside the properties node, you’ll see only the fields that belong to this content type:


{ "GenericSiteBlock_Title": "This is a a test title", "GenericSiteBlock_Subtitle": "This is a test Subtitle", "GenericSiteBlock_Description": "This is a test Description", "GenericSiteBlock_CTA.Text": "Learn More", "GenericSiteBlock_CTA.URL": "https://www.sitecore.com/", "GenericSiteBlock_Image.Asset": "<figure class=\"image\"><img src=\"https://epamdemo.sitecoresandbox.cloud/api/public/content/42fc86ea181d498f9799314cecf9eb36\" /></figure>" }




All other content-type-specific fields (from default or other custom types) will appear as null.

This makes REST ideal when: 

  • You need full entity visibility
  • You want system metadata + content data
  • You’re building integration services or middleware


Using Relations to Fetch Content by Content Type

One of the most important relations for downstream consumption is:

relations.ContentTypeToContent


This relation links: 

  • A Content Type entity 
  • To all content items created using that type



Example: Content Type → Content Items

Calling the content type entity:


https://epamdemo.sitecoresandbox.cloud/api/entities/61827

(where 61827 represents M.ContentType.GenericSiteBlock) returns:


"relations": { "ContentTypeToContent": { "children": [ { "href": "https://epamdemo.sitecoresandbox.cloud/api/entities/62758" }, { "href": "https://epamdemo.sitecoresandbox.cloud/api/entities/62731" } ], "inherits_security": true } }



This tells us:

  • Two content items were created using GenericSiteBlock 
  • Downstream systems can iterate over these child entity URLs 
  • All content of the same type can be fetched dynamically


Why This Matters

This pattern allows downstream apps to:

  • Fetch all content items of a given content type 
  • Avoid hardcoding entity IDs 
  • Build content-type-driven APIs

Option 2: Consuming Content via GraphQL


While REST exposes everything, GraphQL allows downstream apps to request only what they need.

Sitecore CMP exposes GraphQL at:


https://<instance-url>/api/graphql/preview/v1


GraphQL Schema Awareness

CMP automatically generates a GraphQL schema based on:

  • Entity definitions
  • Custom content types
  • Field names (normalized)

For GenericSiteBlock, CMP generates a type like: 

M_Content_GenericSiteBlock


GraphQL Query Example

query getAllGenericSiteContent { allM_Content_GenericSiteBlock { results { genericSiteBlock_Title genericSiteBlock_Subtitle genericSiteBlock_CTA_Text genericSiteBlock_CTA_URL genericSiteBlock_Description genericSiteBlock_Image_Asset } } }


Sample GraphQL Response

{ "data": { "allM_Content_GenericSiteBlock": { "results": [ { "genericSiteBlock_Title": "This is a a test title", "genericSiteBlock_Subtitle": "This is a test Subtitle", "genericSiteBlock_CTA_Text": "Learn More", "genericSiteBlock_CTA_URL": "https://www.sitecore.com/", "genericSiteBlock_Description": "This is a test Description", "genericSiteBlock_Image_Asset": "<figure class=\"image\"><img src=\"...\" /></figure>" }, { "genericSiteBlock_Title": "Ceci est un titre de test", "genericSiteBlock_Subtitle": "Ceci est un sous-titre de test", "genericSiteBlock_CTA_Text": "Apprendre encore plus", "genericSiteBlock_CTA_URL": "https://www.sitecore.com/", "genericSiteBlock_Description": "Ceci est une description de test", "genericSiteBlock_Image_Asset": "<figure class=\"image\"><img src=\"...\" /></figure>" } ] } } }



Notice:

  • Both English and localized (French) content are returned
  • Only requested fields are included
  • No system metadata is exposed unless requested

REST vs GraphQL: The Key Difference


AspectREST APIGraphQL
Data VolumeReturns full entityReturns only requested fields
MetadataAlways includedOptional
PerformanceHeavier payloadOptimized
Schema AwarenessNot requiredRequired
Best ForIntegrations, middlewareFrontend & headless apps


In short:

  • REST exposes everything
  • GraphQL exposes exactly what you ask for

Key Takeaways

Sitecore CMP is designed with flexibility at its core, giving teams multiple ways to expose and consume content across the enterprise:

  • REST APIs provide complete entity access, making them ideal for backend systems, middleware, and deep integrations.
  • GraphQL APIs enable precise and performant content delivery, perfectly suited for headless websites and modern frontend applications.

For architects and integration engineers, the real value lies in selecting the right API for the right consumer, ensuring scalability, performance, and long-term maintainability.


What’s Next?

In Part 6, we’ll shift the focus from delivery to intelligence as we explore:

Elevating Content with AI & Smart DAM Linking

We’ll look at how AI-powered capabilities and intelligent DAM associations can enhance content discoverability, reuse, and downstream experiences—unlocking the next level of value from Sitecore CMP.

Post a Comment (0)
Previous Post Next Post