AEM 6.2 API Options available to access page content | Community
Skip to main content
Mukesh_Kumar_Co
Level 3
Dec 17, 2017 11:17 AM UTC
Solved

AEM 6.2 API Options available to access page content

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.
edubey
edubeyAccepted solution
Level 10
Dec 17, 2017 12:27 PM UTC

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

Mukesh_Kumar_Co
Level 3
Dec 18, 2017 7:18 AM UTC

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

Translate
VeenaVikraman
New Participant
Dec 18, 2017 4:29 AM UTC

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

Translate
edubey
Level 10
Dec 17, 2017 6:20 PM UTC

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

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

Translate
Mukesh_Kumar_Co
Level 3
Dec 17, 2017 2:26 PM UTC

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

Translate
edubey
edubeyAccepted solution
Level 10
Dec 17, 2017 12:27 PM UTC

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/

Translate