Download FIle by FileID

Hi All. can i download the file via webdav api without using remote.php/dav/files/user/path/to/file , i can get the File id, and i want to download the file directly with the help of id as it can be done various ecm tools

Yes, if you go to the sharing menu in the web interface, there is the option “internal link” that gives you a static link in the format:
https://cloud.example.com/f/11233249

and if you have the index.php in your url, you’ll probably need the pretty URLs as well: Installation on Linux — Nextcloud latest Administration Manual latest documentation

@tflidd
Does it really work? For a PDF file showing in Nextcloud i get e.g.

https://cloud.server.tld/index.php/apps/files/files/32?dir=/
https://cloud.server.tld/index.php/apps/files/files/32?dir=/&openfile=true

https://cloud.server.tld/f/32 is only a short url.

But the download link is then

https://cloud.server.tld/remote.php/dav/files/username/name.pdf

Is there a GET-parameter for first two links for direct download? In the online Nextcloud view (first two links) the PDF is also read with WebDAV (browser DEV tools F12 network analysis). So the first two links are more of a jump address into the Nextcloud application.

The situation is different with public links and without passwords. There is the link https://cloud.server.tld/s/abcdefghijklmno and the download link is https://cloud.server.tld/s/abcdefghijklmno/download. With public shared folders, you can also directly address the files contained in a similar way.

the ask is to get the file id from the upload event , and use the download file api, to download the file. the solution you are suggesting is a manual ,

If you use webdav, you should get the eTag and fileID as a response:
https://docs.nextcloud.com/server/latest/developer_manual/client_apis/WebDAV/basic.html#response-headers

i do get the fileid and etag, but i dont see an option to download file with etag or with the file id

You can use the fileID to search for a file:
https://docs.nextcloud.com/server/latest/developer_manual/client_apis/WebDAV/search.html#supported-dav-properties

and then probably get the path and download the file via webdav. It’s a bit complicated and adds another request. If you use the direct link above, you could use the redirection probably as well, however, if they had something like for the other links that you just call https://cloud.example.com/f/11233249/download, that would be nicer.

Perhaps an idea for a feature request, if that does not exist already. It is also possible that there is a nice way that I am not aware of.

Another way to checkout is the direct download API: https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-api-overview.html#direct-download
Although (as with WebDAV above) it requires an additional request.

without id, i have to depend upon /admin/files/test.txt as key, i want to play with the ID as a primary key in one integration scenario, or as you said make PROPFIND call to get the key and then play around , thanks @tflidd if you get a chance kindly look into my another question :wink: Upload the file against a FileID , file name is changed