Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Enabling content as a service in AEM

Avatar

Avatar
Validate 10
MVP
kunal23
MVP

Likes

166 likes

Total Posts

565 posts

Correct Reply

172 solutions
Top badges earned
Validate 10
Validate 1
Ignite 3
Ignite 1
Give Back 50
View profile

Avatar
Validate 10
MVP
kunal23
MVP

Likes

166 likes

Total Posts

565 posts

Correct Reply

172 solutions
Top badges earned
Validate 10
Validate 1
Ignite 3
Ignite 1
Give Back 50
View profile
kunal23
MVP

06-08-2020

Content fragments can now be exposed via new AEM HTTP API.[0]

Is it okay to expose content fragments using this api to external applications or should we expose them via experience fragments, content fragments component and sling model exporter? Any recommendations ? With sling model exporter we have control on the JSON output but it requires additional steps from authors to set up experience fragments along with the content fragments.

 

[0] - https://docs.adobe.com/content/help/en/experience-manager-65/assets/extending/assets-api-content-fra...

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 250
MVP
ChitraMadan
MVP

Likes

272 likes

Total Posts

165 posts

Correct Reply

67 solutions
Top badges earned
Boost 250
Establish
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Boost 250
MVP
ChitraMadan
MVP

Likes

272 likes

Total Posts

165 posts

Correct Reply

67 solutions
Top badges earned
Boost 250
Establish
Ignite 1
Give Back 5
Give Back 3
View profile
ChitraMadan
MVP

06-08-2020

Hi @kunal23 ,

 

It really depends on what your use case is. However, there are two options as per https://docs.adobe.com/content/help/en/experience-manager-learn/sites/content-fragments/content-frag...

  1. Use AEM Content Services and Proxy API pages (Video #2) when the primary use case is deliver Content Fragments for consumption (Read-only) by a 3rd party channel. The Content Services framework provides more flexibility and options as to what data gets exposed. Developers can also extend the Content Services framework to augment and/or enrich the data.
  2. Use the Assets HTTP API (Video #3) when the 3rd party channel needs to modify and/or update Content Fragments. A typical use case is ingesting 3rd party content on an AEM author environment.

 

From personal experience, I have used 1st method, because we wanted to expose content from AEM in a headless manner to our web application and apps.

We had a use case where we had to create different brand pages, which contained different content fragments and then it is exposed to different channels as a micro-service.

 

We find it useful to have the contract of the api in form of content fragment model and then flexibility with the authors to change the content in the pages using different content fragments on the pages and expose it through model.json.

 

The only downside, in my opinion with this approach is that model.json is not much readable, so we developed a micro-service which first transformed model.json in a readable format without nesting and then exposed the response. However, instead of micro-service, you can also do the same thing in Java service/utility in AEM.

 

Let me know if you want a working example of this approach.

Hope this will help!!

 

Answers (1)

Answers (1)

Avatar

Avatar
Give Back 3
Level 4
SundeepKatepally
Level 4

Likes

76 likes

Total Posts

76 posts

Correct Reply

21 solutions
Top badges earned
Give Back 3
Boost 10
Boost 25
Boost 50
Affirm 10
View profile

Avatar
Give Back 3
Level 4
SundeepKatepally
Level 4

Likes

76 likes

Total Posts

76 posts

Correct Reply

21 solutions
Top badges earned
Give Back 3
Boost 10
Boost 25
Boost 50
Affirm 10
View profile
SundeepKatepally
Level 4

06-08-2020

Firstly:

Content Fragment - Is of type dam:asset having data without experience.

Experience Fragment - Is of type cq:Page , which will have data and experience.

 

Any Data stored is content fragment can be exposed as a content service using various ways

 

Option1: Write custom code , which will return the data to external application in json or xml format. 

  Pros: Full control on the contract. Any updates to the content fragment model like adding a new field etc will not impact the contract.

  Con : Developing a code example using servlet.

 

Option2 : Use the OOTB new AEM HTTP API

  Con: No control on the contract. Any new field additions will impact contract.

 

Option2: is suggestible for simple integrations.

Option1 : suggestible for complex integrations.

 

content fragment exposing vis experience fragment --> feel like invalid.