Upload a file to ocis with cURL

I am trying to upload a file via cURL to ocis. I read somewhere that the dav endpoints from ownCloud 10 can also be used with ocis. The used command is from the documentation for ownCloud 10:

curl -u user:pass -T error.log \
  "https://example.com/remote.php/dav/files/USERNAME/error.log"

It looks like cURL indeed is uploading something to somewhere and then exits without an error. But the file doesn’t show up in the webinterface nor in the servers filesystem storage folder of the according user.

Is this not possible yet? I am also not able to add a webdav client (documents on iOS) to ocis. What am I doing wrong?

Did you figure this one out?

You might want to take a look at How to Authenticate to the WebDAV API? - #6 by rkaussow

2 Likes

Thanks for this.
It is rather complicated compared to the approach with ownCloud 10…

It is actually very easy. What you want to do is:

1. Create a "Space" and call it "Backup" for example
2. Create a folder inside that space and call it "Database" for example
3. Under "Actions" of folder "Database" click on "Copy quicklink"
4. Choose "Uploader" insted on "Viewer" bellow your quicklink
5. Your quicklink will look like this: https://example.com/s/JBUbSIDEcmQeqhl 
6. Note the part after /s/
7. curl -T error.log https://example.com/remote.php/dav/public-files/JBUbSIDEcmQeqhl/
8. Profit
6 Likes

Looks like this method does not work with version 3

I use your approach to easily upload live data from my Raspberry Pi and to share a web calendar. If you find a work-around, please let us know. I have not upgraded to version 3, but would like to do so.

It works fine for me when using a PUT request on ocis version 3 (same for older versions, there were no changes on the upload handlers)

curl -X PUT -u user:pass -T error.log \
  "https://example.com/remote.php/dav/files/USERNAME/error.log"

Do you see an error message when uploading?

1 Like