Friday, March 4, 2011

Displaying json for cq:Page components in Day's JCR

I can't believe I didn't realize this sooner. But here is a brief explanation.

Every time I would go to a cq:Page in the JCR and ask for it's json rendition I would only get the json for the cq:Page node.

So asking for http://localhost:4502/content/somePage.json gets your this response:

{"jcr:createdBy":"admin","jcr:created":"Tue Mar 01 2011 19:33:03 GMT-0700","jcr:primaryType":"cq:Page"}
Well the TidyJsonServlet is what is getting called here and it needs a selector to keep recursing down into the page.

So you need to do THIS request instead http://localhost:4502/content/somePage.infinity.json
That will give you the json for the jcr:content node, the bodyContent parsys, and everything underneath that as well. Other selectors you can use are 1, 2, and 3. I think those are the only one's supported in addition to 'infinity'.

FYI!


No comments:

Post a Comment