Expand my Community achievements bar.

How can I include content fragment model property in the OOB asset model json exporter?

Avatar

Level 4

Hi All,

I would like to include the property content fragment 'model' property in the default Asset API model exporter. Surprisingly this property will be exposed when we try page model json but not through asset json exporter. 

Is there any way we can enhance the behaviour to include an additional property?

 

Thanks

1 Reply

Avatar

Level 2

Hi @thatsmeadarsh ,

      If property has to expose via  page model json exporter ,you can use below snippet.

Session session = resourceResolver.adaptTo(Session.class);
try {
Node node = session.getNode("/content/practice/us/en/test");
logger.error(">>>>> node.getName() = '{}'", node.getName());
logger.error(">>>>> node.getPath() = '{}'", node.getPath());

node.setProperty("model", "This is model description.");

logger.error(">>>> node.getProperty(model) = '{}'", node.getProperty("model"));
session.save();
session.logout();
}

catch (RepositoryException e) {
e.printStackTrace();
}

    You can refer to this documentation on default asset api to add a property  if its through asset json exporter 

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/assets/admin/mac...