Expand my Community achievements bar.

How to retrieve dita output in JSON format

Avatar

Level 2

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-Ado...

2 Replies

Avatar

Level 1

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

Avatar

Level 2

Hi @av-ey ,

 

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.