cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to retrieve metadata attributes Java Core API v2

How to retrieve metadata attributes Java Core API v2

Billy S.
New member | Level 1

Hi,

Porting my Android app from Core API v1 to v2, I wonder how to get to metadata attributes such as modified time (server_modified / client_modified), version number, etc. from Java Core API v2.  I am using syntax such as below to retrieve delta.  The question is how to get the above attributes from metadata, which should be available according to v2 documentation.  Could you provide an example how to make such calls?  Thanks in advance.

ListFolderResult result = client.files().listFolder("");
for (Metadata metadata : result.getEntries()) {
...
}


 
4 Replies 4

Greg-DB
Dropbox Staff

Hi Billy, a Metadata object like in your sample can be for either a file, folder, or deleted object, so you need cast it to the respective type, FileMetadataFolderMetadata, DeletedMetadata, to access the properties specific to each. 

For example, you can do something like this:

System.out.println(metadata.getPathLower());
if (metadata instanceof FileMetadata) {
System.out.println(((FileMetadata) metadata).getServerModified());
System.out.println(((FileMetadata) metadata).getClientModified());
System.out.println(((FileMetadata) metadata).getRev());
}

Billy S.
New member | Level 1

Thanks.

inttestsme1
Explorer | Level 3

Hi,

 

This works best for me. Thank you!

alfazraza
Explorer | Level 4
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    alfazraza Explorer | Level 4
  • User avatar
    inttestsme1 Explorer | Level 3
  • User avatar
    Billy S. New member | Level 1
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?