Uploading files through API

(Using Nextcloud 15)

Hi. We want to create a script that use the NextCloud API to upload a file. Right now we’ve tried using the API at:
https://docs.nextcloud.com/server/15/developer_manual/client_apis/WebDAV/basic.html#uploading-files

This let us upload files such as .txt by having the script take the content of the file and use that content in the raw body of the curl request. However this doesn’t seem to work as good with other file types (for example .pdf).

Is there another API call for uploading files to Nextcloud? Or any other alternative ways?

You could upload files with cURL using WebDAV:
https://docs.nextcloud.com/server/latest/user_manual/files/access_webdav.html#accessing-files-using-curl

1 Like

hello,
I’m trying to upload the image file through API, it is uploading the file but the file content is not visible there.