Now, what if you wanted to update a comment. For this we can use the following PUT call: http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/{id}/comments/{commentId}
The Node Identifier for the folder or file node to update the comment for is specified with the {id} parameter. And the comment we want to update is specified with the {commentId} parameter.
The PUT body contains the new comment text:
{ "content": "Updated comment text" }
As an example we will update the latest comment for the file, which has the cace6ed3-1e57-4690-86eb-d9bce01257cf Node Identifier (can be seen in the first listing of comments above):
$ curl -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Basic VElDS0VUXzA4ZWI3ZTJlMmMxNzk2NGNhNTFmMGYzMzE4NmNjMmZjOWQ1NmQ1OTM=' -d '{ "content": "Updated comment text" }' 'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/7279b5c5-da55-4e98-8b12-72d33b90c810/comments/cace6ed3-1e57-4690-86eb-d9bce01257cf' | jq % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 549 0 512 100 37 1706 123 --:--:-- --:--:-- --:--:-- 1823 { "entry": { "createdAt": "2019-12-03T09:32:54.803+0000", "createdBy": { "enabled": true, "firstName": "Administrator", "email": "admin@alfresco.com", "emailNotificationsEnabled": true, "company": {}, "id": "admin" }, "edited": true, "modifiedAt": "2019-12-03T09:54:10.891+0000", "canEdit": true, "modifiedBy": { "enabled": true, "firstName": "Administrator", "email": "admin@alfresco.com", "emailNotificationsEnabled": true, "company": {}, "id": "admin" }, "canDelete": true, "id": "cace6ed3-1e57-4690-86eb-d9bce01257cf", "content": "Updated comment text" } }
The response contains all the information about the updated comment.