a-schild/nextcloud-java-api

[Feature Request] get metadata of file

thepiwo opened this issue · 16 comments

Hello, for me it would be great to be able to fetch some metadata for a file, but I don't know if this is possible. E.g. Date from Metadata App, Uploaded date or versions and maybe preview url that nextcloud gallery generated.

A merge request would be integrated... ;)

I did look into it but didn't find any way to get useful information via webdav, maybe I'll have another look in the future.

Yes, I did try that. The only information this did expose was the etag + date created in nextcloud.

And this one, with the additional properties you can request via PROPFIND?

https://docs.nextcloud.com/server/15/developer_manual/client_apis/WebDAV/basic.html#listing-folders-rfc4918

The same issues, couldn't request more data than etag + date created, but also didn't try extensively.

I have added a method to retrieve the basic meta data of a file.
See the getFileProperties method in NextcloudConnector.
You can use the 11.3.0-SNAPSHOT for this

thank you, I'll have a look into this

This might indeed be a good idea :)
Is done and the snapshot is updated

works for me, but as I thought earlier more info than etag + date created is not available from the webdav approach #35 (comment)

thanks for the implementation, it's definitely helpful, so we can close this issue as it exposes everything that's available from webdav

@thepiwo If you wish to have more properties available, you have to pass them to the webdav api.

modified date, file size, whether it’s a folder, etag and mime type.
What more infos do you need?

Here what would be possible:

<?xml version="1.0"?>
<d:propfind  xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
  <d:prop>
        <d:getlastmodified />
        <d:getetag />
        <d:getcontenttype />
        <d:resourcetype />
        <oc:fileid />
        <oc:permissions />
        <oc:size />
        <d:getcontentlength />
        <nc:has-preview />
        <oc:favorite />
        <oc:comments-unread />
        <oc:owner-display-name />
        <oc:share-types />
  </d:prop>
</d:propfind>

Perhaps add another method api which retrieves all properties?

For my usecase I'd like to access the generated previews for pictures generated, as well as the exif/file date created of the original file, not date created in nextcloud.

What you request is something else.
This NC API we are using, is returning meta data about the file, but not meta data stored inside the file.

The links for you to follow are here:

For the preview images:
https://github.com/nextcloud/photos/

For the Foto API
nextcloud/photos#205

Perhaps older for the gallery:
nextcloud/server#10891
https://github.com/nextcloud/gallery/wiki/RESTful-API

Yes, I did notice after investigating, the changes made give me good basic file info and I can work from here. Thank you!