Upload and get file throught tag properties

Hello everyone,

i try to upload and load files from my Spring boot application. My idea is to add some tags to those file upload those and later using these tags return those files into my application. I now use the Sardine 5.9 to access webdev server. Its possible to do that. If yes how can achieve that?

That for your suggestions.

1 Like

There seems to be a TagsPlugin for DAV and it’s available by default :partying_face:

PropertyName: {http://owncloud.org/ns}tags

That’s the expected format for a tag.

@kesselb thank a lot for your answer. BUt how can i configure this Tagplugin in my application, so that i can get files by tags. Curently i use the library Sardine 5.9 https://github.com/lookfirst/sardine, to get files from the nextcloud server. To return this files, i have to set the remote file path of the file in the request, now what i looking for is just to select the to return files/folders by tags name. Thank you.

I don’t know how to set and read tags with Sardine.

Upload a file with dav

curl -X PUT \
  https://nextcloud.test/remote.php/dav/files/admin/test.png \
  -H 'Authorization: Basic YWRtaW46YWRtaW4=' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: 4056372' \
  -H 'Content-Type: image/jpeg' \

Set tag “Wallpaper” for the uploaded file

  https://nextcloud.test/remote.php/dav/files/admin/test.png \
  -H 'Authorization: Basic YWRtaW46YWRtaW4=' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: 258' \
  -H 'Content-Type: application/xml' \
  -d '<?xml version="1.0"?>
<d:propertyupdate xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">

Request list of files and include tags into response

curl -X PROPFIND \
  https://nextcloud.test/remote.php/dav/files/admin/ \
  -H 'Authorization: Basic YWRtaW46YWRtaW4=' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: 435' \
  -H 'Content-Type: application/xml' \
  -d '<?xml version="1.0"?>
<d:propfind  xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
        <d:getlastmodified />
        <d:getetag />
        <d:getcontenttype />
        <d:resourcetype />
        <oc:fileid />
        <oc:permissions />
        <oc:size />
        <d:getcontentlength />
        <nc:has-preview />
        <oc:favorite />
        <oc:tags />

Using a dav search request is currently not supported. That’s probably a good enhancement request for https://github.com/nextcloud/server/.

@kesselb thank you very much for your help. I will try it.

If you want to set the tags visible with the interface please check this Is there a way to add tags per client API?.

@Arthur1 added the link for people coming via the search.