I want to get the content of a page as json and I want to consume that from an external application. When I tried in author, it works. But it doesn't work in publish instance. Please help on how to make it work on publish instance.
Thanks.
Solved! Go to Solution.
Views
Replies
Total Likes
This should be avoided on publish, because it exposes all JCR properties (including cq:lastModifiedBy properties, which can contain usernames/email addresses). Instead you should define Sling Models and use the Sling Model Exporter to make it available as JSON.
Hi @rakesh_h2 ,
Did you check https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/infinity-json-in-publish-i... this thread ?
hi @rakesh_h2 ,
Please check in dispatcher filters if model.json is allowed. For eg like below
# Allow components JSON model
/0101 { /type "allow" /extension "json" /selectors "model" /path "/content/*" }
This should be avoided on publish, because it exposes all JCR properties (including cq:lastModifiedBy properties, which can contain usernames/email addresses). Instead you should define Sling Models and use the Sling Model Exporter to make it available as JSON.
Hello @rakesh_h2
Can you share the publisher logs to understand what happens when you are trying to access the content of a page as json in publisher?
Hi @rakesh_h2
To expose the pages content as json, use sling model exporters which implements component exporter to expose data as json and allow them in the dispatcher rules.
To expose specific page content as json write a servlet as provided in the link (http://www.nateyolles.com/blog/2015/12/converting-aem-sling-resources-to-json) by excluding OOTB JCR properties and allow the servlet path in dispatcher.
Hi @rakesh_h2 ,
For publisher model.json is restricted to access from dispatcher end. If you want to access the json then add Sling Model Exporter in your model class for the component whichever you are using in your page, also for accessing the page properties data you can add the exporter in your page model class.
Views
Likes
Replies