Hi,
I would like to revive a topic that was asked 2017 but no answer was given. Maybe that changed in 2020:
Is there a way to add tags to a document using the REST or WebDav or whatever API?
If so, could someone give me an example?
I would like to test nextcloud as an DMS and thus have to import several thousend tagged documents.
Thank you, the part with “PROPPATCH” looks pretty much like what I was looking for.
However, appearently it does not work. If I execute it, then I get 200 OK as response but no tag is added. I assume I can see tags in the details as “collaborative tags” or am I mistaken? The name insinuates that there may be other categories of tags.
Maybe important: My nextcloud version is 17.0.2.
BTW: Is there a way to show tags in the files list right next to file names?
I think there are Systemtags what we see on the tab “tag” and there is the property oc:tags which can have a groupof tag-properties. I think you just update property-tags of a resource. To add a systemtag, you can run the following request:
Oh. Collaborative tags (=> systemtags codewise) seems to be a different story than Tags (=> vobjects codewise). I don’t know if there is way how to connect them
Thank you for the hint with the curl-call.
I tried it but it did not work as expected.
First, I added a tag “Test” to a file.
Then I applied daniel512’s command to another file (file id=7) and tag (=1,). I get no response in this case but there appears no tag in the details of the file. When I try another tag id then I get an error response, so I believe the tag id exists.
Even if it worked I have the feeling the process is quite complicated:
Upload a file
Get the Id of the file (I guess via PROPFIND request)
Get the list of tags, check if the desired tag is already there, get the id of it. (No idea how)
You mean the call is what the web client is doing when I add a tag? Smart.
However it does not appear to work in my case. How can I find out what I am doing wrong?
I do not know how to proceed. The curl call does not return an error. I do not know how to list all tags to check the ids. The administrative page in the web client speaks of collaborative tags but your call suggests system-tags which as I understand cannot be seen or used in the web client.
I am that close to migrate my DMS to nextcloud but I would need tags for it and cannot add them manually.
Tags an Nextcloud are a long story. If that is a must have for you better stay with the DMS
I guess there is not much code missing to add support for setting tags via a proppatch call (it’s already possible for the “old” tags with oc:tags). But someone has to do it
I am impressed how fast you answer. Thank you for that.
I rechecked: I had a wrong file id when testing the curl call. I requested the right one per propfind.
Now I can add an existing tag.
Now there are only two pieces missing:
How do I get the ID of a tag and:
How do I add a new tag to the list.
Great. Works as described. Where do you get all this information on the API from?
It is a bit embarassing asking all that info from you bit by bit.
I guess I can get the tag name for a tag id by PROPFINDing /dav/systemtags/x ?
sorry for the late response. As you can imagine after that time I did not find a solution to the remaining issues to use it properly as a lightweight DMS. They are:
I could not find a comprehensive documentation of the API. The best I got is here: Basic APIs — Nextcloud 15 Developer Manual 15 documentation. Mind the number 15 in the URL. I have nowhere the feeling anyone cares for the documentation. However, what is shown there works.
I cannot find a comprehensive list of avaliable properties for the tag list. Because of that I cannot determine the tag name from the ID. Here I am stuck. You need the id to add the tag to the file as described above.
Other issues that keep me from using Nextcloud as DMS up to now:
I use elasticsearch as an search engine. It is great when works. However, the installation needs a plugin to elasticsearch ‘ingest-attachment’. Whenever ubuntu updates eleasticsearch, it stops working as I have to update that plugin manually, even if the update is on the patch level 7.10.X. In nextcloud you don’t notice because the search just silently fails.
Elasticsearch does not search the tags. You can only use the filter on left side navigator.
I have not found out how to display the tags next to the file. I know there was a feature request some years ago but that was set ‘Deprecated’.
I have issues adding tags manually. When I click on the “…” next to a file I have to open ‘details’, then I have to click on ‘…’ for the entry “tags”. However, often the input box for the tags does not open. I do not know what I am doing wrong here. Anyway, too complicated to quickly add tags.
Why I would like to use nextcloud as a DMS anyway:
Best search performance on OCR’ed documents compared to other open-source dms like openkm and mayan.
I can keep a tree structure of the files. Call me antiquated but it helps keeping organized.
Access by file explorer by the sync mechanism. Easier to use with windows than webdav.
Maybe someone has news on my issues and can help solving the tag issue.
I know this a very old topic, but this is for me the first search result on this topic, and as it is not yet fully resolved I would like to add a solution:
List all available system tags, including tag name, so you could get the tag id for the tag name:
I stumbled across this and didnt notice there was an update. I would still love to use Nextcloud as DMS. But I need proper tagging. Especially for my current 3000+ documents. @StefanR Does this also work for collaborative tags. I always get confused by that.