How to retrieve dita output in JSON format | Community
Skip to main content
Level 2
November 22, 2019

How to retrieve dita output in JSON format

  • November 22, 2019
  • 2 replies
  • 2489 views

Hi all,

We are currently evaluating XML Documentation for AEM. The idea is to have all the technical content (dita assets) stored in AEM and exposed them via a bunch of services which the frontend will then consume and render accordingly. The existing frontend has a rich set of JSON APIs exposed out of the existing platform that AEM is set to replace.

We can of course use the Assets HTTP API to retrieve these dita payloads. However, would it not be possible to put one or more of these assets (dita) on a page and then call the page.json to retrieve its JSON output which will contain the dita asset? My current understanding is that doing so will simply return a link to the dita asset in the page's JSON payload. Equally, Sling Model Exporter framework [0] can also be used to customise the JSON by including selective parts of the dita asset in the payload. I am aware of the REST APIs [1] that XML Documentation offers but the need is pretty bespoke JSON payloads to support the headless use case.

Any thoughts or pointers would be immensely appreciated. Many thanks...

[0] Understand Sling Model Exporter

[1] https://helpx.adobe.com/content/dam/help/en/xml-documentation-solution/3-4/XML-Documentation-for-Adobe-Experience-Manage…

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

2 replies

June 29, 2022

@av77 did you end up solving this? We're looking at doing something similar...

Adobe Champion
October 27, 2022

Hi @av77 ,

 

We have done this recently using the Model exporter.

 

Assets HTTP API has its limitation where you may not be able to retrieve everything from a DITA file.

Also the XML Documentation APIs doesn't have an option to retrieve the DITA content as head-less. It provides APIs to operate on AEM Guides for e.g. Download DITA Maps, Convert word documents, getting the inbuilt outputs etc.

 

We have solved this by writing a custom model exporter, which refers the topic model and get the topics respective sub node content (head, body, type, content, and other details) and then outputting this to a json format using SlingRequestProcessor Library.