We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
MateusP
9 years agoHelpful | Level 6
metadata.rev in API v2?
Better late than never, I'm trying to migrate my Android app to API v2. Currently, when downloading a file from a user's linked Dropbox account, I first obtain the file revision... @Override
pro...
- 9 years ago
OK so I worked it out and it's really simple - you just cast to FileMetadata...
FileMetadata metadata = (FileMetadata) mDbxClient.files().getMetadata(mPath+mFilename); String dbxFileRev = metadata.getRev();
If the file is not found, it'll throw a 'FileNotFoundException'
VarunRaj
8 years agoNew member | Level 2
What is mPath??
Is it /App_folder_name/filename ??
Greg-DB
Dropbox Community Moderator
8 years agoVarunRaj The getMetadata method takes the path to the file you're looking for as the "path" parameter. In the sample above, the value being passed in is "mPath+mFilename", which would mean that "mPath" is the path to the parent folder that contains the file with name "mFilename", if any.
Note that if you're using an app with the app folder permission, you should not explicitly pass in the app folder name. You just operate relative to the app folder, so for example, to reference a file "test.txt" direclty in the app folder, you would just pass in "/test.txt".
You can also get the path from the pathLower property on Metadata entries, e.g., as returned by listFolder.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!