list files/folders in owncloud with php curl

Néstor picture Néstor · Oct 17, 2014 · Viewed 9.4k times · Source

this is a strange question but following some of the owncloud api and working with curl i can get a json or a xml output with <url>/cs/v1.php/apps/files_sharing/api/v1/shares

my question is if files_sharing is the only one app that works or if for example files app has another parameters that are not documented.

Thanks in advance.

Answer

Javier Gonzalez picture Javier Gonzalez · Oct 31, 2014

The Share is an API specific just for get the info of the sharing files/folders and also to share them.

To obtain the list of files/folders of a directory you must to use the access through the webdav interface that it is localted under the path remote.php/webdav/ of your server.

For example to get the list of files of the root folder you can use this command:

curl -X PROPFIND -u user:password "http://yourserver.com/owncloud/remote.php/webdav/"

Also you have more http methods to make more things:

  • PROPFIND = get the list of files/folders
  • MKCOL = create folder
  • DELETE = delete file/folder
  • MOVE = move or rename a file or folder
  • PUT = upload file
  • GET = download file