Create a Content Services Endpoint in AEM 6.4
Content Services and what they are for
Content Services let you create page-based HTTP endpoints that render content as normalized JSON.
Configuring and accessing Content Services in AEM 6.4
You need a Content Services endpoint whenever Content Fragment data has to be exported to an external application, such as a single-page application or a mobile app. Endpoint pages are not meant to be viewed as HTML; they only export content as JSON.
Start with a Content Fragment that has several variations — here master, mobile and tab.


1. Create the endpoint page
Go to Sites > We.Retail, click Create > Page, enter the details and click Create. The new page is /content/we-retail/content-service-for-sample-fragment.html.

2. Author the fragment on the page
Open the page and author the Content Fragment on it. Here the master, variation 1 (mobile) and variation 2 (tab) are all authored on the same page.

3. Call the JSON exporter
Append .model.json to the page URL — here content-service-for-sample-fragment.model.json. The JSON includes every variation.

The mobile portion of the JSON:

The tablet portion:

An application can iterate over the Content Fragment section of this JSON and pick the variation for each channel.
This example uses an existing We.Retail template, so the JSON also contains the header, footer and other page parts. In a real project, create a stand-alone template for endpoint pages and create the endpoint page from it.
Related: AEM 6.4 Content Fragment output as JSON.
More in Content Fragments and headless
- Content Fragments in AEM: Models, Editor, Variations and Delivery
Enabling models, the 11 data types, the Content Fragments console and editor, variations, references, publishing and delivery.
- Experience Fragments in AEM, and How They Differ from Content Fragments
Templates, variations, building blocks, MSM, the Experience Fragment component, plain HTML and Adobe Target export.
- AEM Headless Tutorial: From Content Fragments to a React App
Configuration, models, fragments, a GraphQL endpoint, persisted queries and a React client, step by step.
- AEM GraphQL API: Endpoints, Persisted Queries and Examples
The schema from Content Fragment Models, endpoints, GraphiQL, filtering and paging, persisted queries, caching and CORS.
- AEM 6.4 Content Fragment Output as JSON
Why Content Fragments need JSON, the two kinds of fragments, and how to get JSON for a fragment and for a fragment authored on a page with the AEM 6.4 JSON exporter.