Dav REPORT not supported

Nextcloud version (20.4):
Operating system and version (Ubuntu 20.04):
Apache version (Apache 2.4.41):
PHP version (7.4):

Hey all, been trying to write a program to identify faces and add tags of that person to photos. I can run PROPFIND requests without issue, as well as GET, PUT, DELETE. However when I run a REPORT via curl, I get a dav exception that Report is not supported. The command I’m running is trying to return a list of files with a certain tag:

curl -u user:password -X REPORT http://nextcloud-server-address/remote.php/dav/files/user/Photos --data '<?xml version="1.0" encoding="utf-8"?>
<d:propfind xmlns:d="DAV:"
    xmlns:oc="http://owncloud.org/ns"
    xmlns:nc="http://nextcloud.org/ns"
    xmlns:ocs="http://open-collaboration-services.org/ns">
    <d:prop>
        <d:getcontentlength />
        <d:getcontenttype />
        <d:getetag />
        <d:getlastmodified />
        <d:lockdiscovery />
        <d:resourcetype />
        <oc:comments-unread />
        <oc:favorites />
        <oc:fileid />
        <oc:owner-display-name />
        <oc:permissions />
        <oc:share-types />
        <oc:size />
        <oc:tags />
    </d:prop>
    <oc:filter-rules>
        <oc:systemtag>2</oc:systemtag>
    </oc:filter-rules>
</d:propfind>'

Which returns:

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

The output of Nextcloud log:

Sabre\DAV\Exception\ReportNotSupported: 

    /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php - line 89:

    Sabre\DAV\CorePlugin->httpReport()

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 474:

    Sabre\DAV\Server->emit()

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 251:

    Sabre\DAV\Server->invokeMethod()

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 319:

    Sabre\DAV\Server->start()

    /var/www/nextcloud/apps/dav/lib/Server.php - line 332:

    Sabre\DAV\Server->exec()

    /var/www/nextcloud/apps/dav/appinfo/v2/remote.php - line 35:

    OCA\DAV\Server->exec()

    /var/www/nextcloud/remote.php - line 167:

    require_once("/var/www/ne ... p")

It seems that you use the PROPFIND command as well for that:
https://docs.nextcloud.com/server/20/developer_manual/client_apis/WebDAV/basic.html#requesting-properties

PROPFIND does work in this instance, however it returns every file in the folder. PROPFIND just ignores the filtering which is what I’m hinging upon. I had pieced together the REPORT request from OwnCloud’s Tags API docs because Nextcloud’s docs were lacking in this instance.

You can set tags:

I think the best is to get some clarification on all that and fix this properly in the documentation:

Yes, I knew I could set tags by the Dav API, just was wanting a way to search files and only return those with a certain tag. In the first link you posted, I attempted a different REPORT command, a copy/paste of what’s written in the GitHub issue:

You can also list favorites in a more “DAV” way using

REPORT remote.php/dav/files/user/path/to/folder
<?xml version="1.0"?>
<oc:filter-files  xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
	 <oc:filter-rules>
		 <oc:favorite>1</oc:favorite>
	 </oc:filter-rules>
 </oc:filter-files>

Which will return the same XML format a when doing a PROPFIND and supports requesting properties in the same way as a PROPFIND by adding a <d:prop/> element to the request.

This returned the same error as before, REPORT not supported.

At this point I’m leaning towards a miss-configuration with DAV on my side, though I’m not sure exactly where. I’ll start combing through the docs on github and open an issue there if I cannot find exactly what I’m looking for.

@tflidd
I have resolved the issue, though I could have sworn I attempted this before and that’s how I got stared on this rabbit hole… The trick was to replace the opening <d:propfind> brackets with <oc:filter-files>
My request now looks like:

curl -u user:password -X REPORT 'http://server-ip/remote.php/dav/files/user/' --data '<?xml version="1.0" encoding="utf-8"?>
<oc:filter-files xmlns:d="DAV:"
    xmlns:oc="http://owncloud.org/ns"
    xmlns:nc="http://nextcloud.org/ns"
    xmlns:ocs="http://open-collaboration-services.org/ns">
    <d:prop>
        <d:getcontentlength />
        <d:getcontenttype />
        <d:getetag />
        <d:getlastmodified />
        <d:lockdiscovery />
        <d:resourcetype />
        <oc:comments-unread />
        <oc:favorites />
        <oc:fileid />
        <oc:owner-display-name />
        <oc:permissions />
        <oc:share-types />
        <oc:size />
        <oc:tags />
    </d:prop>
    <oc:filter-rules>
        <oc:systemtag>2</oc:systemtag>
    </oc:filter-rules>
</oc:filter-files>'

This request returns a properly filtered list of files with the requested tag.
Thanks for your help!

1 Like

If you have some more nice examples, it would be great to share them in the documentation to help others.

1 Like

I don’t have any besides this one I’m working with, but I can open a pull request in the documentation repo with some mock ups of similar requests.

1 Like