To the seasoned Adobe Experience Manager (AEM) architect the mention of a new content as a service feature might garner a raised eyebrow. After all, AEM has long provided (we thought) “content as a service” through use of Sling Selectors. That is any AEM page can be dissected by the use of selectors. See: https://sling.apache.org/documentation/the-sling-engine/url-decomposition.html.
Therefore, content as a service is already in good standing… right? Having been involved in projects that use selectors to syndicate content, I can tell you there are gaps in that model. Namely aggregation and governance. A problem we would solve with a custom servlet. Content as a Service in AEM 6.3 will solve those many of those challenges.
AEM 6.3’s Content as a Service (CaaS) is an editor-empowered tool to provide an aggregated view of content within the JCR. That content can be assets, content fragments or pages, intended for external consumption. Uses would typically be mobile applications, portals, external web applications, or even an AEM site itself.
In this article, we’ll show you how to expose an aggregate view of content fragments, which would otherwise require custom development in AEM 6.2. Welcome to AEM CaaS.
CaaS is disabled by default. Use the AEM system console to enable via the AEM Content Services Feature Flag:
Create the Service
Digitizing the Healthcare and Patient Experience
Find out how more than 100 healthcare executives and their respective organizations are modernizing patient and customer experiences.
Using Touch UI, click Mobile, then Spaces:
Create a space.
Entities are the content you are expositing, and can be either an Asset Model or Page Model (additional models can be created). The space you created above is a container for entities. Create an entity:
Choose the Asset Model.
Fill-in the information, and click Create:
Once you’ve created the entity, click Open:
We’ve already created a couple of example content fragments, so let’s choose those. Click the +Add button:
Select the content fragments:
Click Save under Save & Close:
You should see a success message:
Preview the Service on Author
Click on the Preview link and you’ll what the service looks like in jSON format. Note that you can change the selector name and depth.
We can also view this directly on the Author instance:
Preview the Service on Publish
To preview on Publish, we must first publish the service (which will also publish the content). Click Save & Close:
Click Publish Tree:
Navigate back into the service by clicking Edit:
Click Open on Publish:
To fetch the asset, click on the href and download the content fragment:
Open the downloaded fragment in an editor:
This is the way the fragment looks back in the Content Fragment Editor.
As we can see, CaaS enables a non-developer to easily create a service, and then manage what content available via the service. You’ll likely want to use AEM permissions to secure editor access to this feature.
The CaaS entities are stored under /content/entities, so permission management should not be a challenge.
On the Publish instance, all features available to ordinary content should also work, like securing via Dispatcher or usage of Closed User Groups to restrict access.
Give it a try and let us know!