Experience fragment export as json to consume in third party application | Adobe Higher Education
Skip to main content
Level 3
April 6, 2022
Répondu

Experience fragment export as json to consume in third party application

Hello,

I am trying to expose experience fragment as JSON data where experience fragment has custom component. I can get the desired JSON with path http://localhost:4502/content/experience-fragments/my-project/us/en/site/globalnav/master/jcr:content/root/globalnav.model.json where globalnav is resource node name created for our custom component.

 

But my question is that resource node name may change if we reauthor the component & component resource may get different name like "globalnav_randomnumber". How can we get reliable resolver path to access JSON from third party in above scenario ?. @mihnead @joerghoh 

 

 

Ce sujet a été fermé aux réponses.
Meilleure réponse par SundeepKatepally

It doesnt make sense to expose http://localhost:4502/content/experience-fragments/my-project/us/en/site/globalnav/master/jcr:content/root/globalnav.model.json this link as a content server as it has jcr:content in it , also you are replying on the node formed by component. If someone removes the global nav component from the XF and readd and author it , then your content service will fail

 

Suggestion - to use Content service as  http://localhost:4502/content/experience-fragments/my-project/us/en/site/globalnav/master.json --> to incorporate this do the necessary changes in the model

2 commentaires

RajaShankar
Community Advisor
Community Advisor
April 6, 2022

Hi @pradeepmoolemane 

Component name wont change for edit of same component unless you add the same component once again to the resposnive grid in that case for second one it will appear as componentname_numericidentifier eg: image_198892222

 

As per my understanding we can handle this using regular expression pattern for json variable at the third party consumer.

 

Regards,

Rajashankar.R

Level 3
April 7, 2022

yes, with edit wont change node name. but if we think robust nature, author have option to delete & readd the component. So with this, component name can change at any point.

SundeepKatepally
Community Advisor
Community Advisor
April 6, 2022

It doesnt make sense to expose http://localhost:4502/content/experience-fragments/my-project/us/en/site/globalnav/master/jcr:content/root/globalnav.model.json this link as a content server as it has jcr:content in it , also you are replying on the node formed by component. If someone removes the global nav component from the XF and readd and author it , then your content service will fail

 

Suggestion - to use Content service as  http://localhost:4502/content/experience-fragments/my-project/us/en/site/globalnav/master.json --> to incorporate this do the necessary changes in the model

Level 3
April 7, 2022

Hi @sundeepkatepally thanks for your reply. with master.json, I get only injected node structure data and default structure. But we have some costume logic and consume json structure that wont come up with master.json or master.<depth>.json.

 

Can you please provide any reference example where we can get custom data as well.

Level 3
April 7, 2022

and is there a way to restrict to add a component only once in a page ?