You can add comments to both folders and files. This is part of the collaboration features that exists around nodes. There is also like/unlike and tagging of nodes.
Comments are added to nodes with the following POST call: http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/{id}/comments
The Node Identifier for the folder or file node to add the comment to is specified with the {id} parameter. Then a POST body is created with the comment as follows:
{ "content": "This is a comment" }
It’s possible to add more than one comment at a time as follows:
[ { "content": "This is a comment" }, { "content": "This is another comment" } ]
Let’s look at an example of how to add a comment to a file (it would be done in the same way for a folder).
Let’s assume we have a file with the 7279b5c5-da55-4e98-8b12-72d33b90c810 Node Identifier, the call would then look like this:
$ curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Basic VElDS0VUXzA4ZWI3ZTJlMmMxNzk2NGNhNTFmMGYzMzE4NmNjMmZjOWQ1NmQ1OTM=' -d '{ "content": "This is a comment" }' 'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/7279b5c5-da55-4e98-8b12-72d33b90c810/comments' | jq % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 544 0 510 100 34 717 47 --:--:-- --:--:-- --:--:-* 764 { "entry": { "createdAt": "2019-12-03T09:32:54.803+0000", "createdBy": { "enabled": true, "firstName": "Administrator", "email": "admin@alfresco.com", "emailNotificationsEnabled": true, "company": {}, "id": "admin" }, "edited": false, "modifiedAt": "2019-12-03T09:32:54.803+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": "This is a comment" } }
The response contains more information about the added comment, such as its Node Identifier (i.e. id).