To list all the tags for a file (or folder) we can use the following GET call: http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/{id}/tags
The Node Identifier for the folder or file node to get the tags for is specified with the {id} parameter.
As an example we will get all the tags for the file we just added a comment to:
$ curl -X GET -H 'Accept: application/json' -H 'Authorization: Basic VElDS0VUXzA4ZWI3ZTJlMmMxNzk2NGNhNTFmMGYzMzE4NmNjMmZjOWQ1NmQ1OTM=' 'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/7279b5c5-da55-4e98-8b12-72d33b90c810/tags' | jq % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 186 0 186 0 0 5470 0 --:--:-- --:--:-- --:--:-- 5470 { "list": { "pagination": { "count": 1, "hasMoreItems": false, "totalItems": 1, "skipCount": 0, "maxItems": 100 }, "entries": [ { "entry": { "tag": "project-x", "id": "a427120f-a679-43e6-bcc5-4b0be1f91ea3" } } ] } }
The response is constructed in the usual way for lists, with a pagination section at the start and then entries.
We can see that the file has one tag. If you just wanted to return the tag text and leave out the tag id, then we can use the fields parameter as follows:
$ curl -X GET -H 'Accept: application/json' -H 'Authorization: Basic VElDS0VUXzA4ZWI3ZTJlMmMxNzk2NGNhNTFmMGYzMzE4NmNjMmZjOWQ1NmQ1OTM=' 'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/7279b5c5-da55-4e98-8b12-72d33b90c810/tags?fields=tags' | jq % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 142 0 142 0 0 10142 0 --:--:-- --:--:-- --:--:-- 10923 { "list": { "pagination": { "count": 1, "hasMoreItems": false, "totalItems": 1, "skipCount": 0, "maxItems": 100 }, "entries": [ { "entry": { "tag": "project-x" } } ] } }