Query for getting content fragment variants as JSON

Avatar

Avatar
Boost 10
Level 2
AD-Engineer
Level 2

Likes

10 likes

Total Posts

28 posts

Correct reply

0 solutions
Top badges earned
Boost 10
Validate 1
Ignite 1
Give Back 3
Give Back
View profile

Avatar
Boost 10
Level 2
AD-Engineer
Level 2

Likes

10 likes

Total Posts

28 posts

Correct reply

0 solutions
Top badges earned
Boost 10
Validate 1
Ignite 1
Give Back 3
Give Back
View profile
AD-Engineer
Level 2

21-06-2021

Hi,

We are trying to get create products with content fragments. But, each product has its own variants. How can we get as JSON each CF with its variants?

queryMap.put("path", "/content/dam/products");
        queryMap.put("type","dam:Asset");

        queryMap.put("1_property","jcr:content/@contentFragment");
        queryMap.put("1_property.value","true");

With this I am getting only the CF, but not its variants. Thanks!

View Entire Topic

Avatar

Avatar
Boost 5
Level 7
Ritesh_M
Level 7

Likes

179 likes

Total Posts

142 posts

Correct reply

44 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 1
View profile

Avatar
Boost 5
Level 7
Ritesh_M
Level 7

Likes

179 likes

Total Posts

142 posts

Correct reply

44 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 1
View profile
Ritesh_M
Level 7

21-06-2021

Hi @AD-Engineer ,

 

We have HTTP Asset APIs available for Content Fragment. Let me give you example. if your CF is created under '/content/dam/products' then you can access all the CF inside products folder using below GET call-

 

 

http://<HOST>:<PORT>/api/assets/products.json

 

 

I have created a Simple CF with variant to showcase what I mean.

 

1. Created a new CF under '/content/dam/we-retail' using OOTB CF model.

 

cf-folder.png

 

2. Created two variations (with different RTE authored) and saved.

3. Now accessing http://localhost:4502/api/assets/we-retail.json is giving me both variants.

 

cf-json-result.png

 

Please watch this video to understand-

https://www.youtube.com/watch?v=wtO_GwZggig

Hope it helps!

Cheers!