set cq:lastModified using curl command
How to set cq:lastModified (2018-02-21T15:24:18.000Z) using curl command for a particular page eg(http://localhost:4502/content/xyz/language/en-us/abc/pqr/jcr:content)
How to set cq:lastModified (2018-02-21T15:24:18.000Z) using curl command for a particular page eg(http://localhost:4502/content/xyz/language/en-us/abc/pqr/jcr:content)
@hello299 . You may use Sling Post Servlet to update properties by POST call to jcr:content path. You may import the below curl command(update auth headers if needed) into Postman and execute it for batch if required.
curl --location --request POST 'http://localhost:4502/content/xyz/language/en-us/abc/pqr/jcr:content' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'cq:lastModified=2018-05-11T11:45:03.673+05:30' \
--data-urlencode 'cq:lastModified@TypeHint=Date'
But there is an observation when you update cq:lastModified property via Sling Post, it updates the property back again to current modified timestamp. AFAIK, you have to do some custom script development for your correction and use that endpoint.
ResourceResolver resourceResolver = request.getResourceResolver();
Resource resource = resourceResolver .getResource("<pagepath>/jcr:content");
ModifiableValueMap modifiableValueMap = resource.adaptTo(ModifiableValueMap.class);
modifiableValueMap.put("cq:lastModified", <date value>);
resourceResolver.commit();
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.