Meta API

Introduction

An authenticated PROPFIND request to remote.php/dav/meta/<fileid> returns the path to a file/folder for the logged in user.

To retrieve a list of available files, use the Filter Files endpoint, and ensure that returned properties includes fileid.

Core Details

Request Path Method Content Type

remote.php/dav/meta/<fileid>

PROPFIND

text/xml

Request Parameters

Attribute Type Description

fileid

integer

The file’s id.

The example above uses xmllint, available in the libxml2 package to make the response easier to read.

Example Responses

Success

If the file of folder is found, then a response similar to the following will be returned with an HTTP/1.1 207 Multi-Status status:

<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
  <d:response>
    <d:href>/remote.php/dav/meta/7/</d:href>
    <d:propstat>
      <d:prop>
        <oc:meta-path-for-user>/Photos/San Francisco.jpg</oc:meta-path-for-user>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

Failure

If the file is not found, then the following response will be returned with an HTTP/1.1 404 Not Found status:

<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\NotFound</s:exception>
  <s:message/>
</d:error>

Example Request

  • Curl

curl -u username:password \
  -X PROPFIND \
  -H "Depth: 0" \
  -H "Content-Type: text/xml" \
  --data "@meta-files.xml" \
  'https://owncloud.install.com/owncloud/remote.php/dav/meta/<fileid>' | xmllint --format -

meta-files.xml

<?xml version="1.0"?>
<a:propfind xmlns:a="DAV:" xmlns:oc="http://owncloud.org/ns">
    <a:prop>
        <oc:meta-path-for-user/>
    </a:prop>
</a:propfind>