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
- 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
From an empty configuration to a React client reading persisted queries.
- 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
Kept as an AEM 6.4 note: the JSON exporter.