We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.

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.
  • 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.

  • Здравко'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.

About Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,875 PostsLatest Activity: 3 hours ago
323 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!