You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

user44's avatar
user44
Explorer | Level 4
8 months ago

How to get FileMetaData object representing metadata of a file in Dropbox, using Java SDK?

In this guide of Dropbox it is nicely explained how to deal with files and folders in Dropbox using their API. But on reaching the endpoint to fetch files and folders in a location using Java SDK instead of list of FileMetaData objects we get MetaData objects which has much less fields for files/folders compare to FileMetaData. Is there a way to get FileMetaData objects instead of MetaData ones directly via API call, using the Java SDK?

 

DbxRequestConfig config = DbxRequestConfig.newBuilder("dropboxClient").build();
DbxClientV2 dbxClient = new DbxClientV2(config, "<access_token>");

ListFolderResult result = dbxClient.files().listFolderContinue("<last_cursor>");
List<MetaData> listMetaData = result.getEntries(); // Is there a way I can get list of FileMetaData objects instead of MetaData.
  • Здравко's avatar
    Здравко
    Legendary | Level 20

    user44 wrote:

    ... Is there a way to get FileMetaData objects instead of MetaData ones directly via API call, using the Java SDK?

    ...


    Hi user44,

    The Metadata class is just a basic class that multiple other classes derive from. This class is the common things between FilesMetadata, FolderMetadata, and DeletedMetadata. You never receive Metadata class instance in fact! All the time when you use that interface, it points to an instance of the classes already mentioned. Just a simple check will show you what it actually is. Take a look here for example.

    Hope this helps.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    Check out the sample here for an example of how to check for and work with the different metadata types in the Java SDK.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,888 PostsLatest Activity: 3 hours ago
326 Following

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 or Facebook.

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!