Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

AEM Asset API not updating jcr:lastModified and jcr:lastModifiedBy of content fragment

Avatar

Level 2
Hi All, We have an internal tool to update content fragment using Asset API. We found that jcr:lastModified and jcr:lastModifiedBy information is not updating while making updates to content fragment using AEM asset api. We tried to add modifiedBy & modified properties in request body but no luck. Could you please advise on this method: 'put', url: '/api/assets/', data: '{"properties":{"modifiedBy":"admin","modified":"","contentFragment":true,"elementsOrder":["state","plan"],"elements":{"state":{":type":"string","title":"State","multiValue":true,"dataType":"string","value":["NY"]},"plan":{":type":"string","title":"Plan","multiValue":true,"dataType":"string","value":["1234"]}}}}', Thanks, Seran
4 Replies

Avatar

Community Advisor

Modified and modified by property are protected property in aem. These properties values are maintained by aem and can’t be modified by any script or even via crx/de

Avatar

Level 1

Thank You for your reply PraksahRaj. Do we have a way to get these values updated when an update happened to content fragment from AEM asset api

Avatar

Level 2

Thank You for your reply PraksahRaj. Do we have a way to get these values updated when an update happened to content fragment from AEM asset api

Avatar

Community Advisor

you don't need /asset/api to work with content fragment. its only required for assets.

I am not sure how your internal tool works with if you go with simple curl you can update the content fragment data using below curl command

curl -u admin:admin http://localhost:4502/content/dam/content-fragments/{your_content_fragment_path}/jcr:content -F "modifiedBy=admin" -F "contentFragment=true"