Moving a file in nextcloud via webDAV API fails

I am trying to run a CURL command from a linux command line that is supposed to move a file to a different folder, according to this manual: Basic APIs — Nextcloud latest Developer Manual latest documentation

First I created the folder:

curl '' --user 'user:password' --request MKCOL

This works fine, so the basic syntax etc is working.
Then I am trying to move a file to this folder:

curl ' 18-24-52.mp4' --user 'user:password' --request MOVE -H 'Destination:'

However, on this I am getting a 400 error with “Your browser sent a request that this server could not understand.”. I tried several different sequences in the command (not sure if it matters), short (-X) and long (–request) flags and dropping the last / on the target directory but I could not figure out.

I checked the logfile while having it on DEBUG mode but while the MKCOL call leaves it’s traces there, there is no logfile content AT ALL regarding the MOVE request.

Nextcloud version (eg, 20.0.5): Nextcloud Hub 5 (27.0.1)
Operating system and version (eg, Ubuntu 20.04): Almalinux 9.2
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.53
PHP version (eg, 7.4): PHP 8.2.9


Since your source is a file the destination also needs to be a file. i.e. include the full filename in the destination path. Also, I don’t remember how finicky curl is, but add a space after the colon.

So something like:


Thanks, tried it, but it still does not work, neither the space nor having a file name on the destination changes something.
I am really stumped by the fact that there is absolutely no logfile entry on debug mode for this on nextcloud.
Apache acknoledges the transaction in one line with the 400 status code, but that’s it.

Is there anything I need to do to enable MOVE in some sense?

Actually, the issue is with the space in the file name. You need to replace it with %20 when you do CURL.

1 Like