Skip to content

Commit dfd9d72

Browse files
committed
chore(developer): Add documentation about new WebDAV endpoint for downloading folders
* Add WebDAV folder-download endpoint documenation * Add changelog entry for new endpoint * Add changelog entry for deprecated and removed legacy endpoints Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent a8d511a commit dfd9d72

File tree

2 files changed

+57
-3
lines changed

2 files changed

+57
-3
lines changed

developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_31.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ Back-end changes
6868
Added APIs
6969
^^^^^^^^^^
7070

71+
- It is now possible to download folders as zip or tar archives using the WebDAV backend using :code:`GET` requests.
72+
See the relevant :ref:`endpoint documentation<webdav-download-folders>`.
7173
- ``OCP\SetupCheck\CheckServerResponseTrait`` was added to ease implementing custom :ref:`setup checks<setup-checks>` which need to check HTTP calls to the the server itself.
7274

7375
Changed APIs
@@ -79,12 +81,17 @@ Changed APIs
7981
Deprecated APIs
8082
^^^^^^^^^^^^^^^
8183

82-
- TBD
84+
- The ``/s/{token}/download`` endpoint for downloading public shares is deprecated.
85+
Instead use the Nextcloud provided :ref:`WebDAV endpoint<webdav-download-folders>`.
8386

8487
Removed APIs
8588
^^^^^^^^^^^^
8689

8790
- Legacy, non functional, ``OC_App::getForms`` was removed.
91+
- The private and legacy ``OC_Files`` class was removed.
92+
Instead use ``OCP\AppFramework\Http\StreamResponse`` or ``OCP\AppFramework\Http\ZipResponse``.
93+
- The private and legacy Ajax endpoint for downloading file archives (``/apps/files/ajax/download.php``) was removed.
94+
Instead use the Nextcloud provided :ref:`WebDAV endpoint<webdav-download-folders>`.
8895
- All ``OCP\ILogger`` logging methods, deprecated since Nextcloud 20, are removed.
8996
- The interface now only holds the Nextcloud internal logging level constants.
9097
For all logging ``Psr\Log\LoggerInterface`` should be used.

developer_manual/client_apis/WebDAV/basic.rst

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,23 @@ for each operation, further information for each operation can be found in the c
1010
WebDAV basics
1111
-------------
1212

13-
The base url for all WebDAV operations for a Nextcloud instance is :code:`/remote.php/dav`.
13+
The base url for all (authenticated) WebDAV operations for a Nextcloud instance is :code:`/remote.php/dav`.
1414

1515
All requests need to provide authentication information, either as a basic auth header or by passing a set of valid session cookies.
1616

17-
If your Nextcloud installation uses an external auth provider (such as an OIDC server) you may have to create an app password. To do that, go to your personal security settings and create one. It will provide a username and password which you can use within the Basic Auth header.
17+
If your Nextcloud installation uses an external auth provider (such as an OIDC server) you may have to create an app password.
18+
To do that, go to your personal security settings and create one. It will provide a username and password which you can use within the Basic Auth header.
19+
20+
Public shares
21+
^^^^^^^^^^^^^
22+
23+
The :code:`/remote.php/dav` endpoint only allows authenticated access to WebDAV resources,
24+
for files shared using public link shares a different endpoint is provided which does not require authentication.
25+
26+
The base URL for public link shares is :code:`/public.php/dav`, particularly for files: :code:`/public.php/dav/files/{share_token}`.
27+
If a password is set for the share then a basic auth header must be sent with ``anonymous`` as the username and the share password as the password.
28+
29+
.. note:: This endpoint for public shares is available since Nextcloud 29.
1830

1931
Testing requests
2032
----------------
@@ -343,12 +355,47 @@ You can request properties of a folder without also getting the folder contents
343355
Downloading files
344356
-----------------
345357
358+
.. note:: For shared files this only works if the download permission was not denied by the sharer.
359+
346360
A file can be downloaded by sending a :code:`GET` request to the WebDAV url of the file.
347361
348362
.. code::
349363
350364
GET remote.php/dav/files/user/path/to/file
351365
366+
.. _webdav-download-folders:
367+
368+
Downloading folders
369+
-------------------
370+
371+
.. note:: The :code:`GET` method is not defined by the WebDAV standard, this is a Nextcloud specific WebDAV extension.
372+
.. note:: For shared folders this only works if the download permission was not denied by the sharer.
373+
374+
A folder can be downloaded as an archive by sending a :code:`GET` request to the WebDAV URL of the folder.
375+
The :code:`Accept` header must be set and contain the MIME type for ZIP archives (:code:`application/zip`) or tarballs (:code:`application/x-tar`).
376+
377+
.. code::
378+
379+
GET remote.php/dav/files/user/path/to/folder
380+
Accept: application/zip
381+
382+
Optionally it is possible to only include some files from the folder in the archive by providing the files using the custom :code:`X-NC-Files` header:
383+
384+
.. code::
385+
386+
GET remote.php/dav/files/user/path/to/folder
387+
Accept: application/zip
388+
X-NC-Files: document.txt
389+
X-NC-Files: image.png
390+
391+
As setting headers is not possible with HTML links it is also possible to provide this both options as query parameters.
392+
In this case the :code:`Accept` header value must be passed as the :code:`accept` query parameter.
393+
The optional files list can be provided as a JSON encoded array through the :code:`files` query parameter.
394+
395+
.. code::
396+
397+
GET remote.php/dav/files/user/path/to/folder?accept=zip&files=["image.png","document.txt"]
398+
352399
Uploading files
353400
---------------
354401

0 commit comments

Comments
 (0)