API - File operations

Hello community,

I would like to know more on the API, to do some operations, via script (i.e. PHP) like:

  • Create folder
  • Copy file
  • Rename file
  • Set file and/or folder permissions

Would anyone send me some info and/or documentation on how that could be achieved.

Thanks in advance.

Hi there,

WebDAV is the API we are using for File operations :wink: … What do you exactly want to do?



Hi MariusBluem,

First of all, thank you for your reply.

We would like to do what was mencioned, first just to know and interact with the platform.

  • Create folder (create a shared folder via script)
  • Copy file (origin and destination via script)
  • Rename file
  • Set file and/or folder permissions (change them via script)

Nothing too fancy in a way that allow us to get better understanding of the platform.

Thank you.

Everything you said there (except for the filefoder permissions) can easily be done via webdav. Just let your program/script/etc create a folder in dav://yournextcloud/ instead of C:/.

A file Renaming could quite easily be done then by calling something like:

mv dav://yournextcloud/folder/filenameold.jpg dav://yournextcloud/folder/filenamenew.jpg

I am sure, almost every Script/Programming Language can handle webdav, if it can handle file operations.

For the permissions, I would create special NextCloud Folders with the Share Permissions to the groups/users and let my script create files insider there, again via webdav.