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
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Morris Jobke <hey@morrisjobke.de>
* @author Roeland Jago Douma <roeland@famdouma.nl>
* @author Sergio BertolĂn <sbertolin@solidgear.es>
* @author Thomas Citharel <tcit@tcit.fr>
* @author Thomas MĂĽller <thomas.mueller@tmit.eu>
* @author Vincent Petry <pvince81@owncloud.com>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
This file has been truncated. show original
There seems to be a TagsPlugin for DAV and it’s available by default
PropertyName: {http://owncloud.org/ns }tags
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Morris Jobke <hey@morrisjobke.de>
* @author Thomas MĂĽller <thomas.mueller@tmit.eu>
* @author Vincent Petry <pvince81@owncloud.com>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
This file has been truncated. show original
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.
kesselb
January 13, 2020, 10:52am
4
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
curl -X PROPPATCH \
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">
<d:set>
<d:prop>
<oc:tags>
<oc:tag>Wallpapers</oc:tag>
</oc:tags>
</d:prop>
</d:set>
</d:propertyupdate>'
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:prop>
<d:getlastmodified />
<d:getetag />
<d:getcontenttype />
<d:resourcetype />
<oc:fileid />
<oc:permissions />
<oc:size />
<d:getcontentlength />
<nc:has-preview />
<oc:favorite />
<oc:tags />
</d:prop>
</d:propfind>'
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.