How can I construct a WebDAV URL for a specific file?

From the docs, I understand that if the base URL of my instance is

example.com/nextcloud

I can construct a webDAV URL (e.g. for accessing the instance with a file manager) by adding /remote.php/dav/files/USERNAME/.

But for my use case, I want to be able to access a single file on Nextcloud via WebDAV (like this).

Is it possible to construct a URL for this purpose?

You’re on the right track. Files are accessible from the URL you’ve provided ie. /remote.php/dav/files/USERNAME/myfile.txt or /remote.php/dav/files/USERNAME/my/folder/file.txt .

IMO It’s a missing GUI feature. We should get a button to copy the Webdav URL in the file context menu.

1 Like

It works – thanks very much!

Most spots across the various NC manuals have sections about accessing files through WebDAV via cURL. Even if you’re not using cURL, those spots will provide hints for the URLs and access methods necessary for doing various things in your own scripts:

https://docs.nextcloud.com/server/latest/user_manual/en/files/access_webdav.html#accessing-files-using-curl

https://docs.nextcloud.com/server/latest/developer_manual/client_apis/WebDAV/chunking.html?highlight=curl

https://docs.nextcloud.com/server/latest/developer_manual/client_apis/WebDAV/bulkupload.html?highlight=curl

https://docs.nextcloud.com/server/latest/developer_manual/client_apis/WebDAV/basic.html?highlight=curl#webdav-basics

And that’s just using WebDAV… There are also loads of APIs that can be accessed - and more all the time - to do various things or access functionality provided by apps.

Way beyond what you asked, but figured a decent spot to drop these links for future searchers. Good luck!