AEM 6.2 API Options available to access page content | Community
Skip to main content
Mukesh_Kumar_Co
Level 3
December 17, 2017
Solved

AEM 6.2 API Options available to access page content

  • December 17, 2017
  • 5 replies
  • 1974 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by edubey

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-tutorial-develop.html

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

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

5 replies

edubey
edubeyAccepted solution
Level 10
December 17, 2017

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-tutorial-develop.html

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

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

Mukesh_Kumar_Co
Level 3
December 17, 2017

@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}}}

edubey
Level 10
December 17, 2017

Did you tried below, it will give you entire page content.

http://localhost:4502/content/geometrixx/en/toolbar/contacts.-1.json

VeenaVikraman
Community Advisor
Community Advisor
December 18, 2017

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

Mukesh_Kumar_Co
Level 3
December 18, 2017

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