BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Dropbox API v2 Launched for Swift, Python, .NET, and Java

Dropbox API v2 Launched for Swift, Python, .NET, and Java

Leia em Português

Dropbox has announced its API v2, which supports four SDKs: Swift, Python, .NET, and Java, is generally available to developers. According to Dropbox, Dropbox API v2 is “simpler, more consistent, and more comprehensive”. Currently, API v2 does not support JavaScript and Objective-C.

Among the changes in Dropbox API v2 is a more extensive use of HTTP POST verb, including for endpoints that return structured data, such as getting the current account’s info, or a file’s metadata:

curl -X POST https://api.dropboxapi.com/2-beta-2/users/get_current_account \
    --header "Authorization: Bearer <access-token>" \
    --header "Content-Type: application/json" \
    --data "null"

curl -X POST https://api.dropboxapi.com/2-beta-2/files/get_metadata \
    --header "Authorization: Bearer <access-token>" \
    --header "Content-Type: application/json" \
    --data "{\"path\": \"/cupcake.png\"}"

All requests take JSON and return JSON structured data in their body. Additionally, a new, non-standard error code has been added to handle requests that fail due to any call-specific reason. In such cases, the API will return a 409 code, which has the advantage, Dropbox say, of not being standard, so it will be relied along by proxies or client libraries.

Dropbox API v2 also introduces new features, such as:

  • File IDs to allows developers to identify a file even if it is moved and can be used as a path replacement.
  • Shared links can be now listed and revoked, while previously it was only possible to create them; furthermore, developers will be allowed to share folders and manage policies and membership/
  • A new API explorer allows developers to test API calls from the browser to discover its features.

A feature which was present in Dropbox API v1 and has not been included yet in v2 is support for range headers in files/download. This is in Dropbox’s plan for prompt inclusion.

As mentioned, Dropbox API v2 does not support Objective-C and JavaScript. Initially, Dropbox stated they had no plan to release an Objective-C version of API v2, thus relying on Objective-C Swift interoperability. On the other hand, it seems that API v2 SDK for Swift is not ready yet to be used from Objective-C due language compatibility issues with Swift structs and enums. On the contrary, JavaScript support is planned but it is still not clear when it will become available.

Rate this Article

Adoption
Style

BT