- Tutorial Overview
- Part 1 - Installing AEM Content Services
- Part 2 - Defining FAQ Content Fragment Models
- Part 3 - Authoring FAQ Content Fragments
- Part 4 - Defining Content Services Templates
- Part 5 - Authoring Content Services Pages
- Part 6 - Exposing the Content on AEM Publish
- Part 7 - Consuming AEM Content Services from a 3rd Party App
In production scenarios, AEM Content Services should serve content from AEM Publish, and from directly from AEM Author.
This section enables the FAQ App to connect directly to AEM Author, rather than AEM Publish, in the even the learners computer is unable to run both AEM Author and AEM Publish simultaneously. Serving the content from AEM Author requires anonymous access to be enabled via the Apache Sling Authenticator OSGi service, which is a security concern on live AEM systems.
If AEM Publish cannot be run, the Part 6b AEM package can be installed on AEM Author to:
If only AEM Author is used, skip to the Part 7 of the tutorial, as the rest of Part 6 concerns publishing content and configuration to AEM Publish.
The configuration and content created to drive the FAQs through AEM Content Services should be published to AEM Publish for consumption.
Because AEM Content Services is built from Configuration, Assets and Pages, all of these pieces automatically enjoy AEM's OOTB content managment capabilities, including Workflow for review and processing, and activation/deactivation for pushing and pulling content from the public AEM Content Services end-points.
While it is possible to expose content using AEM Content Services directly from AEM Author, this should only be done for intra-organizational consumers and with caution. Potential pitfalls include:
- AEM Author content is protected by default, requiring consuming Apps to provide credentials.
- Evolving the Content Fragment Models, Template definitions and API Page authoring is immediately reflected on AEM Author (as the publication gateway does not exist). This can result in a volatile API that may break consuming Apps.
- Traditionally AEM Author content is not cached at dispatcher. Special consideration should be taken to address if/how the JSON content can be safely cached or how to mitigate the load.
The preferred paradigm is to publish the content to AEM Publish, as described in this tutorial.
Publish the API pages and all references (templates, assets, etc.)
- Navigate to AEM > Sites > We.Retail
- Select the API page
- Tap the Manage Publication in the top action bar
- Leaving the default Publish action as-is, tap Next in the top action bar
- Select the API page
- Tap +Include Children
- Uncheck all options in the Include Children modal
- Tap Done
- Tap Publish in the top action bar
The page publication should publish all unpublished references as well, including:
- The FAQ Main API Template
- The FAQ Listing API Template
- All references FAQ Content Fragments
- Any other referenced content (ie. the Logo image)
If changes are made to this content or configuration after the initial publication, make sure to re-publish to see the effects on AEM Publish.
On AEM Pubish, open CRXDE Lite.
- Ensure you are logged in as admin (or a user that can manage ACLs)
- Navigate to /conf/we-retail/settings/dam
- Select the cfm node
- Tap Access Control in the bottom-left pane
- Tap the + to add an ACL
- Add an ACE
- Principal: everyone
- Type: allow
- Privileges: jcr:read
- Log out of AEM Publish to return to anonymous state
CORS (Cross-Origin Resource Sharing) must be enabled on AEM Publish to allow the React-based FAQ App to connect to AEM Publish and consume content.
- As the admin user, access http://localhost:4503/system/console/configMgr
- Create a new configuration policy for the Adobe Granite Cross-Origin Resource Sharing Policy
- Set the Allowed Origins to http://localhost
- Set the Allowed Origins (Regexp) to .*
- Set the Allowed Methods to GET
- Steps 3-4 allows the FAQ App to run on any host/port; This is only acceptable for local, tutorial use.
- Click Save when done
In a new Web browser, ensure you are logged out of AEM Publish and request the following URLs (substituting http://localhost:4503 for whatever host:port AEM Publish is running on).
These requests should return the same JSON response as when the corresponding AEM Author end-points were reviewed. If they do not, ensure all Publications succeeded (check the Replication queues) and review the error.log for AEM Publish.
Optionally, install the aem-content-service-tutorial.part6 solution package via AEM Publish's AEM's Package Manager. This package contains the configurations and content outlined in this part of the tutorials