How to use Content Fragment Model OpenAPI to update CF? | Community
Skip to main content
sarav_prakash
Community Advisor
Community Advisor
September 19, 2024
Solved

How to use Content Fragment Model OpenAPI to update CF?

  • September 19, 2024
  • 2 replies
  • 1340 views

I am trying to leverage the new OpenAPIs to programatically update CF from AppBuilder runtime action. 

 

The Create Content fragment  API works correctly. I am able to create CF from Postman. But when I try the Update CF, it is failing with 412 stating If-Match header is failing. 

 

Now, the way I run is, I am calling List CF, getting the UUID of CF from response and passing to PUT request. I am reading If-Match header needs should be populated with `ETag`. But my List CF response is NOT returning any ETag as explained in documentation. This is the List CF response

Only an id is returned by GET method. If any additional headers required to force the GET method to return `ETag`. Or any alternate workaround to get past If-Match header validation? 

 

CORRECTION:

I was able to find the etag in the response header of GET CF<id> method. But this makes API more difficult to use. I only have CF path and want to patch update. The process sounds to be:

  1. Find CF ID using List
  2. Find etag using Get
  3. Edit CF using Patch.

If this the moving forward way to update CF even if we know exact CF path? 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by EstebanBustamante

Hi @sarav_prakash ,

 

Short answer: Yes. My understanding of this behavior is that these new APIs adhere to OpenAPI specifications and are meant to be consistent across all other AEMaaCS solutions. The long answer can be found here: AEM Gems - 19th June 2024.

 

Additionally, since these APIs are still in development and being updated, Adobe encourages providing feedback on them. I highly recommend that you email the team responsible for the APIs at aem-apis@adobe.com to share your feedback. I agree that there should be a way to streamline those three call processes. If you receive any response from them, please post back for the community.

 

Hope this helps!

2 replies

EstebanBustamante
Community Advisor and Adobe Champion
EstebanBustamanteCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
September 19, 2024

Hi @sarav_prakash ,

 

Short answer: Yes. My understanding of this behavior is that these new APIs adhere to OpenAPI specifications and are meant to be consistent across all other AEMaaCS solutions. The long answer can be found here: AEM Gems - 19th June 2024.

 

Additionally, since these APIs are still in development and being updated, Adobe encourages providing feedback on them. I highly recommend that you email the team responsible for the APIs at aem-apis@adobe.com to share your feedback. I agree that there should be a way to streamline those three call processes. If you receive any response from them, please post back for the community.

 

Hope this helps!

Esteban Bustamante
sarav_prakash
Community Advisor
Community Advisor
September 20, 2024

yup. looks like this is it. sounds like stuck with unfortunate option. I too have reached to my adobe CSM and ticket. i ll close once I hear back from them.

h_kataria
Community Advisor
Community Advisor
September 19, 2024

You can possibly skip 1st step if you are creating the cf first and then trying to modify it as you will be getting the cf id in response for creation. Rest don't see any workaround. Still following this thread to see if anyone has anymore ideas. 

sarav_prakash
Community Advisor
Community Advisor
September 20, 2024

No I have update scenarios also. wer I wont create, just have to edit properties.