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
New Participant
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
  • 4634 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

matthieu_théria
New Participant
October 16, 2015

Hi Kalyanar,

I have tried and modified your sample for my needs. It works! Thanks for your help.

If  I traverse all nodes in the path "mywebsite/content", is it possible to determine if a page or a page content uses a social component?

Thanks,

Matthieu

Employee
October 16, 2015

It will work for any path wiht this selector.