Sling model exporter capability | Community
Skip to main content
JakeCham
Level 6
December 21, 2023
Solved

Sling model exporter capability

  • December 21, 2023
  • 3 replies
  • 1031 views

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!

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 arunpatidar

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.

3 replies

JakeCham
JakeChamAuthor
Level 6
December 21, 2023

Hi @arunpatidar 

 

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

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
December 21, 2023

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
Mahedi_Sabuj
Community Advisor
Community Advisor
December 22, 2023

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

 

 

Mahedi Sabuj
joerghoh
Adobe Employee
Adobe Employee
December 22, 2023

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/components/json-exporter-components.html?lang=en