Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Sling model exporter capability

Avatar

Level 7

Hi Team,

 

I'm trying to get used of Sling model exporter capability where http://localhost:4502/content/<prject>/en/page/jcr:content/parsys/component.model.json

 

But I 'm getting an error saying Invalid recursion selector value 'model'.

How I  can get sorted this ?

 

Note - Is this we can use only for content fragment with a content fragment proxy component ?

 

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @JakeCham 
OOTB, It is not possible to get the specific component data in json format. but you can create your own servelt with that selector and return the json data.



Arun Patidar

View solution in original post

5 Replies

Avatar

Level 7

Hi @arunpatidar 

 

Can't we get specific component data inside page in json format rather whole page data ?

Avatar

Correct answer by
Community Advisor

Hi @JakeCham 
OOTB, It is not possible to get the specific component data in json format. but you can create your own servelt with that selector and return the json data.



Arun Patidar

Avatar

Community Advisor

Hi @JakeCham,

You need to make sure your component has Sling Model implementation; otherwise you'll encounter Invalid recursion selector value 'model' error. 

@Model(
  adaptables = { SlingHttpServletRequest.class },
  adapters = { Article.class },
  resourceType = { Article.RESOURCE_TYPE },
  defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
@Exporter(
  name = ExporterConstants.SLING_MODEL_EXPORTER_NAME,
  extensions = ExporterConstants.SLING_MODEL_EXTENSION)
public class Article {
  protected static final String RESOURCE_TYPE = "aem-demo/components/article";
  // Implementation
}

http://localhost:4502/content/aem-demo/us/en/jcr:content/root/container/container/artice.model.json

 

 

Avatar

Employee Advisor

You can get any Sling Model exported, you just need to prepare the model for it, see the documentation here: https://experienceleague.adobe.com/docs/experience-manager-65/content/implementing/developing/compon...