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:conten... 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 @Jörg_Hoh
Solved! Go to Solution.
Views
Replies
Total Likes
It doesnt make sense to expose http://localhost:4502/content/experience-fragments/my-project/us/en/site/globalnav/master/jcr:conten... 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
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
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.
Views
Replies
Total Likes
It doesnt make sense to expose http://localhost:4502/content/experience-fragments/my-project/us/en/site/globalnav/master/jcr:conten... 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
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.
Views
Replies
Total Likes
and is there a way to restrict to add a component only once in a page ?
Views
Replies
Total Likes
You can register a custom script/servlet to the resourcetype "cq/experience-fragments/components/experiencefragment" using the selector "navigation", which then is able to provide you the required information. Then you can you use a request like
to retrieve the navigation stored at this XF. Content Services might be a good way as well, but it requires you to adjust your content structure a bit (having the navigation as a standalone fragment).
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies