Dropbox Api Download File

admin 11/22/2021
6 Comments

The Dropbox API enforces rate limits on the number of API calls issued over a period of time on a per-authorization (token) basis

  • For user-links, rate limits apply per user who has linked your app. Multiple apps that a user may have linked don’t contribute to each other’s rate limiting.
  • For team-links, rate limits apply per team when calling Business Endpoints. If your team-linked app is calling User Endpoints on behalf of team members with Dropbox-API-Select-User, the rate limits apply per team member.
Cannot download dropbox files

If your application experiences a rate limit, the API call will return an HTTP 429 error, returning the reason of too_many_requests (in JSON, or plaintext - per the Content-Type HTTP header).

  1. I want to download the files from dropbox and need to keep it in my server on behalf of dropbox user. I tried with curl and filegetcontents. But could not succeed. Should I need to use any api method of dropbox? I could able to download the file from browser but I need to keep it in server. My application is a kind of file sharing.
  2. The Saver is the easiest way to add files to your users' Dropbox accounts. With two clicks, a user can download files of any size into their Dropbox, making those files available on all their computers and devices as soon as the download completes. The Saver works on web and mobile web—all with just a few lines of code.

@mikezelton The Dropbox API download endpoints, e.g., /2/files/download and /2/files/downloadzip, return the requested data in the response body. What you/your HTTP client do with that response is up to you. By default, curl just shows the data in stdout. You may want to use curl's `-output` option to specify a location to save it to instead. The Dropbox API allows developers to work with files in Dropbox, including advanced functionality like full-text search, thumbnails, and sharing. The Dropbox API explorer is the easiest way to get started making API calls. Request and response formats. In general, the Dropbox API uses HTTP POST requests with JSON arguments.

Rate limited responses always include a Retry-After header that provides the limit in seconds that your app would need to wait before retrying to ensure a successful response.

Dropbox api download file example

Rate limited requests themselves also count towards rate limits, and thus rapid retry loops without pause or respecting this header will be counter-productive.

While Dropbox does not publish exact rate limits, these limits are not designed to inhibit normal applications. Your application should handle 429 errors as described. If your application receives excessive rate limit responses, it may suggest inefficient call patterns that should be optimized.

Data Transport Limit

Also, note that certain Dropbox Business plans are also subject to a special kind of rate limiting for /files/upload calls. For more information, see the Data transport limit page.

Files and folders in Dropbox may be shared via a shared link. These shared links are publicly accessible by default, but may be set to expire and/or have their visibility limited to logged-in team members or to those with the password. When you share a link with someone, they can view and download that content with the same quality as the original file.

Creating Shared Links

Using the Dropbox API, you create shared links by calling /sharing/create_shared_link_with_settings. The endpoint takes two parameters: path and settings.

The path parameter is a file reference and can be a file path, file id, revision, or namespace relative path. The settings parameter controls the behavior and visibility of the shared link. An existing shared link’s settings can be modified by calling /sharing/modify_shared_link_settings.

Some examples:

  • An accountant wants to securely provide a completed tax packet to their client by using a shared link with a password. Their settings include requested_visibility set to password and the link_password set to a private password they share with their client.
  • A teacher running an all day science lab wants to provide students with access to research materials for a limited amount of time. They create a shared link to a folder that will expire after a set period of time by using the expires parameter.

Shared Link Visibility

If no settings are provided, then the shared links will default to pubic visibility, but are subject to the folder’s sharing policy which may be set to team only. Folder sharing policies are covered in the “Shared folders” section of this guide.

Shared links created using the Dropbox user interface can disable downloads, but there is not an equivalent setting using the API.

Editable Shared Links

For most content in Dropbox, shared links are view-only and download-only. However, for files that can be edited in the cloud (like Microsoft, Google, or Paper), it is possible to create shared links that grant the recipient permission to edit. This can be done by setting access to editor in a the shared link settings for a cloud-editable file.

For cloud-editable files, if the audience is set to no_one, then the link serves as a pointer to the content but access is limited to the pre-existing access rights.

How Shared Links Relate to Files

For cloud-editable files like the ones mentioned above, the shared link generated is unique to that content. That means if multiple users create a shared link to the same cloud-editable file it will be the same link. However, that behavior only applies to cloud-editable files.

For most files in Dropbox, any shared links that are generated are unique to a specific user. In other words, the shared link I create to cat_in_a_box.jpg is different than the shared link you create to the same file. This distinction is relevant for team apps.

Reading Shared Links

Dropbox Java Api Download File

The /sharing/list_shared_links endpoint will return all shared links that allow access to a given path for the given user. If no path is provided, the endpoint will return all shared links for the user making the API call.

The default behavior of the endpoint is to provide shared link visibility flowing upwards in the folder structure. When given a specific path to a file or folder, the return will include direct links to the given path and links to its parent folder. However, the inverse is not true and shared link visibility does not flow downwards.

Cannot Download Dropbox Files

An example:

  • Calling /sharing/list_shared_links with path='/Homework'does not return links to “/Homework/Cat_Research.docx”.
  • Calling /sharing/list_shared_links with path='/Homework/Cat_Research.docx' returns shared links to that file and links to “/Homework”.

Dropbox Api Download File

Example /sharing/list_shared_links output with path='/cat pictures/bed_cat.jpg':