I'm using Sites API to list and delete Content Fragments. In particular:
For deletion endpoint, there are 2 required params:
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
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @AMahdzich_Bayer,
if that is the case, it sure sounds like a bug. Please report the issue to Adobe Support.
Daniel
@AMahdzich_Bayer which AEMaaCS Release are you currently using?
This issue may have been addressed in one of the recent releases.
Hi @AMahdzich_Bayer ,
Please refer to this post https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager-ideas/enhance-openapi-cont...
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
Fails: It didnt work when I create
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?
@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>`
Views
Replies
Total Likes
@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
Views
Replies
Total Likes
@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?
Views
Replies
Total Likes
Hi @AMahdzich_Bayer,
correct, sorry, get the Etag value from the response headers.
Good luck,
Daniel
Views
Replies
Total Likes
Hi @daniel-strmecki ,
What response headers you mean? I want to make a single list request to get all CFs and delete them afterwards. I don't think there is a response header for the list endpoint ("GET /adobe/sites/cf/fragments") with array of ETAgs.
Views
Replies
Total Likes
Hi @AMahdzich_Bayer,
yes, but there is also no API to delete CFs in build, AFAIK. So you would need to:
Then loop through them and for each CF:
Good luck,
Daniel
Hi @daniel-strmecki,
I see that "List all Content Fragments" returns `etag` field for each CF.
Views
Replies
Total Likes
Hi @AMahdzich_Bayer,
if that is the case, it sure sounds like a bug. Please report the issue to Adobe Support.
Daniel
Views
Replies
Total Likes
@AMahdzich_Bayer This is the ideas section. For bugs, you need to create a support ticket. Please work with your CSM/TAM in this regard.
Views
Replies
Total Likes
Views
Likes
Replies