API - Is there a way to retrieve the data of a social component in a structured way? | Community
Skip to main content
matthieu_théria
Level 2
October 16, 2015
Solved

API - Is there a way to retrieve the data of a social component in a structured way?

  • October 16, 2015
  • 12 replies
  • 4655 views

Hi,

I have not found how to do what I want in the AEM documentation or in a tutorial...

Is there a way to retrieve the data of a social component in a structured way? I know that I can retrieve specific nodes in the repository, but I need to figure out how the social component is implemented in the repository (nodes structure).

Is it possible to get the forum and its posts for example. What would be the best method to do this (JCR API, Sling, AEM API)?

Thanks,

Matthieu

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

Hi Matthieu,

You can use Query Builder to retrieve all forums.(http://docs.adobe.com/docs/en/aem/6-0/develop/search/querybuilder-api.html)

type=cq:PageContent
property=cq:template
property.value=/apps/aaa/greater/templates/new-community

Would return you paths to the forums within the website.

To find out every component under certain path, again you can use query builder to select certain resources under known path.

e.g. 

type=cq:PageContent
property=cq:template
property.value=/apps/aaa/greater/templates/my-topic
path=/path/to/my-forum

Once you retrieve paths to your individual items(forums, posts or topics) you can call adaptTo method to adapt resource from path to your desired component. You already have adapters for forums and posts provided with out of the box AEM 6. (http://localhost:4502/system/console/status-adapters).

Thanks,

Peter

12 replies

Peter_Puzanovs
Community Advisor
Community Advisor
October 16, 2015

Yes, it's possible to view data as strucktured json. Your API in this case would be a wget request to the corresponding component path as json.

For example data displayed on https://communities.adobe.com(who also use social component) can be viewed by adding json selector at the end of the url.

https://communities.adobe.com/content/dam/cush/aem_technologistsdevelopersarchitects/Ask-AEM-Community-Expert-Replication.mp4.form.html/content/cush/en/communities.2.json shows you the structure used on the communities website.

Thanks,

Peter

Adobe Employee
October 16, 2015

what version of AEM and what social components(jsp or handlebars) are you using