A single call for metadata and file content

Posted by Ramesh Balakrishnan on January 19, 2012

Until now, retrieving a file’s metadata and its content required two API calls - one to retrieve the metadata and another to get the file’s contents at the revision indicated in the metadata.

We recently updated the /files REST API call to start returning the file’s metadata in a special header (x-dropbox-metadata) in the HTTP response. Accordingly, we extended all the official SDKs to expose the metadata along with the file’s contents when a client requests a file download. We also made a similar change to the /thumbnails call (and added corresponding methods to the SDKs) that returns the metadata for the file whose thumbnail is being requested. Please refer to the CHANGELOGs and documentation on each SDK for details on the new interfaces.

These changes should make your client code simpler (especially if revision number isn’t important to you) and more efficient (one network call, instead of two). We will be deprecating older interfaces in a future release (with ample lead time).

Python
get_file_and_metadata()/thumbnail_and_metadata() supersede get_file()/thumbnail()

Ruby
get_file_and_metadata()/thumbnail_and_metadata() supersede get_file()/thumbnail()

iOS
DBRestClient.m now contains new loadedFile()/loadedThumbnail()callbacks that also include the metadata, superseding older callbacks.

Java
DropboxAPI.DropboxFileInfo now supports getMetadata() (nothing to deprecate).

Stay tuned to our developers site and follow @dropboxapi on Twitter for future updates.