"List all Content Fragments" endpoint does not return proper ETag | Community
Skip to main content
AMahdzich_Bayer
Level 2
April 11, 2025
Solved

"List all Content Fragments" endpoint does not return proper ETag

  • April 11, 2025
  • 3 replies
  • 1367 views

I'm using Sites API to list and delete Content Fragments. In particular:

 

  • 'List all Content Fragments" endpoint to get CFs to delete
  • "Delete a Content Fragment" to delete each CF

For deletion endpoint, there are 2 required params:

 

  • "fragmentId" in path
  • "If-Match" in header

I'm getting values for these params from "List all Content Fragments" response for each CF.

 

Example of GET response:

{ "items": [ { "path": "<...>", "title": "<...>", "description": "<...>", "id": "1833c3df-1345-4c4d-84d5-211c1cc3cd1f", "created": {}, "modified": {}, "status": "DRAFT", "previewReplicationStatus": "NEVER_PUBLISHED", "model": {}, "validationStatus": [], "fields": [], "variations": [], "tags": [], "references": [], "fieldTags": [], "etag": "\"a6b0c90be2c9222696e83ded059108e7\"", "tagsCount": 0 } ] }

 

Example of DELETE request:

curl -i -X DELETE \ 'https://author-p56105-e395653.adobeaemcloud.com/adobe/sites/cf/fragments/1833c3df-1345-4c4d-84d5-211c1cc3cd1f?unlinkReferences=false' \ -H 'Authorization: Bearer <MY_JWT>' \ -H 'If-Match: \"a6b0c90be2c9222696e83ded059108e7\"'

 

As you see, I provide appropriate values for the request, but I'm getting "Precondition Failed" error:

 

{ "type": "https://api.adobeaemcloud.com/adobe/meta/errors/precondition_failed", "title": "Precondition Failed", "status": 412, "detail": "If-Match header does not match the current ETag of the resource", "requestId": "c647d94c-a91d-4be5-87a6-e52154f9c365" }

 

What's the reason of such behavior? Why API returns not valid ETag value? How can I delete CF?

 

Notes

  • As for today, getting individual CF ("Get a Content Fragment" endpoint) does not return `etag` at all
  • ETag value from "List all Content Fragments" endpoint contains double quotes inside it (see my code snippet above) - is it expected?
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 daniel-strmecki

Hi @daniel-strmecki,

 

I see that "List all Content Fragments" returns `etag` field for each CF.

  • Please confirm that this value is not correct.
  • If so, why does API return it at all? It's leading to confusion and I would consider the removal of it.

Hi @amahdzich_bayer,

if that is the case, it sure sounds like a bug. Please report the issue to Adobe Support.

 

Daniel

3 replies

muskaanchandwani
Adobe Employee
Adobe Employee
April 11, 2025

@amahdzich_bayer which AEMaaCS Release are you currently using?
This issue may have been addressed in one of the recent releases.

sarav_prakash
Community Advisor
Community Advisor
April 14, 2025

Hi @amahdzich_bayer ,

Please refer to this post https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager-ideas/enhance-openapi-content-fragment-for-list-fragments/idc-p/748317#M2301

 

I faced the same problem last year. Recently it started working. And I realized couple gotchas.

Works: etags are returned only for fragments created using 

  1. CF Open API -  https://developer.adobe.com/experience-cloud/experience-manager-apis/api/experimental/sites/ 
  2. From the new CF console 
  3. Using FragmentTemplate java API FragmentTemplate.createFragment.

Fails: It didnt work when I create  

  1. directly using ResourceManager.create as sling resources. Creating individual nodes
  2. using the CF Asset API - https://experienceleague.adobe.com/en/docs/experience-manager-65/content/assets/extending/assets-api-content-fragments#create
  3. Using Create Fragment from DAM console. Not using the new CF admin console. 

Some affinity is happening mandating to use the OpenAPI to create fragments. Can you please try creating using OpenAPI and check if Lists API is returning? 

AMahdzich_Bayer
Level 2
April 15, 2025

@muskaanchandwani  how can I check which AEMaaCS Release I'm using?

 

The URL I use to delete CF: `https://<BUCKET>.adobeaemcloud.com/adobe/sites/cf/fragments/<ID>`

 

 
daniel-strmecki
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
April 15, 2025

@amahdzich_bayer, I think you are just using the wrong ETag value in your request. Try to use the ETag value in the If-Match that you received in the response that failed with the precondition error.

c647d94c-a91d-4be5-87a6-e52154f9c365

 

BR,

Daniel

daniel-strmecki
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
April 16, 2025

@daniel-strmecki The value "c647d94c-a91d-4be5-87a6-e52154f9c365" is the Request ID.

According to documentation, "requestId" is

 

A unique identifier that is assigned to the request, either by the API caller or by the service itself.

 

I think ETag should identify the resource version, not API request. Are sure this is correct?


Hi @amahdzich_bayer,

 

correct, sorry, get the Etag value from the response headers.

 

Good luck,

Daniel