Programmatically create a ContentFragment.

Avatar

Avatar
Ignite 5
Level 2
aliaksandr_hvoz
Level 2

Likes

5 likes

Total Posts

16 posts

Correct reply

0 solutions
Top badges earned
Ignite 5
Ignite 3
Ignite 1
Give Back 3
Give Back
View profile

Avatar
Ignite 5
Level 2
aliaksandr_hvoz
Level 2

Likes

5 likes

Total Posts

16 posts

Correct reply

0 solutions
Top badges earned
Ignite 5
Ignite 3
Ignite 1
Give Back 3
Give Back
View profile
aliaksandr_hvoz
Level 2

04-05-2020

Hi guys.

Please advise me on this situation. I make a request to a specific server and get a JSON. After that, based on my data, I have to programmatically create a content fragment. This content fragment has a template. Maybe you have an example. 

 

Thank you very much in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Give Back
Employee
Amol_Anand
Employee

Likes

2 likes

Total Posts

3 posts

Correct reply

1 solution
Top badges earned
Give Back
Boost 1
Affirm 1
View profile

Avatar
Give Back
Employee
Amol_Anand
Employee

Likes

2 likes

Total Posts

3 posts

Correct reply

1 solution
Top badges earned
Give Back
Boost 1
Affirm 1
View profile
Amol_Anand
Employee

04-05-2020

There are multiple options to programmatically create Content Fragments in AEM.

 

1. You can use Assets HTTP API to create content fragments once you know what needs to go into the Fragment:

https://docs.adobe.com/content/help/en/experience-manager-65/assets/extending/assets-api-content-fra...

 

2. If you were already within AEM's context, you could also create content fragments programmatically as described in the following link: https://docs.adobe.com/content/help/en/experience-manager-65/developing/extending-aem/customizing-co...

 

Answers (3)

Answers (3)

Avatar

Avatar
Give Back 5
Employee
sunjot16
Employee

Likes

106 likes

Total Posts

164 posts

Correct reply

50 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 25
Give Back 10
Give Back
View profile

Avatar
Give Back 5
Employee
sunjot16
Employee

Likes

106 likes

Total Posts

164 posts

Correct reply

50 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 25
Give Back 10
Give Back
View profile
sunjot16
Employee

05-05-2020

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,462 likes

Total Posts

3,329 posts

Correct reply

949 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,462 likes

Total Posts

3,329 posts

Correct reply

949 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

05-05-2020

If you can use Experience Fragments instead of Content Fragment, would add lot of flexibility and easiness.
Not sure about your use case though.

 

Sample code - https://aemdeveloper.wordpress.com/2017/08/22/create-access-the-content-fragment-programmatically/

Avatar

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

487 likes

Total Posts

1,049 posts

Correct reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

487 likes

Total Posts

1,049 posts

Correct reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile
Veena_Vikram
MVP

04-05-2020

@aliaksandr_hvoz  What exactly is your ask ? You need a sample to create CF programmatically ?