kallada
kallada

Reputation: 1929

Exposing CQ content as a restful webservice

We are facing a scenario where we need to to expose our CQ content (as XML or JSON) to serve as an integration point. Any pointers to achieve this a would be helpful.

San

Upvotes: 2

Views: 1571

Answers (3)

Selva
Selva

Reputation: 11

Write a selector jsp(json.html.jsp) in your component and call your service method that will return the JSON based on your need.

So your request URL with selector say ../home.json.html will return the desired json output.

Note : Make sure when you don't override cq default json calls. Eg: when your request URL is like ../home.json and your selector jsp is json.jsp , this will override the out of box json call and you will find authoring dialog working not expected.

Upvotes: 1

Mohit Bansal
Mohit Bansal

Reputation: 384

Content in AEM can be made available to end users in several ways, like html page, PDF, xml, json.

Sitemap.xml is one of similar content. You can create custom restful APIs to read content from JCR repository, put them in required format (xml/json or some other) and expose it to end users. As @chrysler said, take a look at sling docs for more learning.

Upvotes: 1

chrysler
chrysler

Reputation: 458

everything is content! you can get json-output of every node simply but you probably want to implement a custom servlet to server specific requirements i guess. try this:

http://192.168.56.56:4503/content/geometrixx-outdoors/en/men/coats.infinity.json http://192.168.56.56:4503/content/geometrixx-outdoors/en/men/coats.3.json

Take a look at the sling docs and learn how sling is resolving resources (sling cheat sheet)

Upvotes: 2

Related Questions