Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

AEM 6.2 API Options available to access page content

Avatar

Level 4

We are working on a custom solution to use content from AEM instance. Using HTTP API(http://localhost:4502/api/content/sites/geometrixx/en.json) we can get details of page but not the content inside a custom solution. I am wondering if using HTTP API we can also get page content. If no, which API we can use to get the content of pages? Can anyone please suggest.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Technically, you can use -1.json to get complete data under content node


but Using default .json rendered is not the idea solution to consume data from AEM. There are two better ways you can look at

1. Sling Model Exporter - https://helpx.adobe.com/experience-manager/kt/platform-repository/using/sling-model-exporter-tutoria...

2. Content as a Service - https://helpx.adobe.com/experience-manager/kt/sites/using/structured-fragments-content-services-feat...

https://blogs.perficient.com/adobe/2017/04/21/aem-6-3-first-looks-content-as-a-service/

View solution in original post

5 Replies

Avatar

Correct answer by
Level 10

Technically, you can use -1.json to get complete data under content node


but Using default .json rendered is not the idea solution to consume data from AEM. There are two better ways you can look at

1. Sling Model Exporter - https://helpx.adobe.com/experience-manager/kt/platform-repository/using/sling-model-exporter-tutoria...

2. Content as a Service - https://helpx.adobe.com/experience-manager/kt/sites/using/structured-fragments-content-services-feat...

https://blogs.perficient.com/adobe/2017/04/21/aem-6-3-first-looks-content-as-a-service/

Avatar

Level 4

@edubey, thanks for your quick response. I am not getting complete data using HTTP API. For page http://localhost:4502/api/content/sites/geometrixx/en/toolbar/contacts.json I am getting json containing properties of page but not the exact content showing on the page as contacts. Also, second point seems to be applicable to AEM 6.3 only.

{"links":[{"rel":["self"],"href":"http://localhost:4502/api/content/sites/geometrixx/en/toolbar/contacts.json"},{"rel":["parent"],"href":"http://localhost:4502/api/content/sites/geometrixx/en/toolbar.json"},{"rel":["content"],"href":"http://localhost:4502/content/geometrixx/en/toolbar/contacts.infinity.json"}],"class":["content/page"],"properties":{"dc:title":"Contact","subtitle":"mail","cq:toolbars":["top"],"cq:lastModified":"2010-11-11T23:06:35.180+01:00","name":"contacts","cq:lastModifiedBy":"admin","cq:template":"/apps/geometrixx/templates/contentpage","srn:paging":{"total":0,"offset":0,"limit":20}}}

Avatar

Community Advisor

Hi Mukesh

     If I am not wrong, you want to show the data of some dynamic components in your page. I am wondering if you SlingRequestProcessor might help ?

SlingRequestProcessor (Apache Sling (Builder) 6 API)

Here is a sample Get the HTML markup for a resource in AEM / CQ. · GitHub

Thanks

Veena

Avatar

Level 4

@edubey, I am able to get contents using mentioned query. Thanks.