cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Rate Limit Dropbox API in Web application.

Rate Limit Dropbox API in Web application.

Bya23
New member | Level 2

Hello,

I'm hosting a web service that downloads images from the user's dropbox using a shared link. Think thousands of users. 

To download the images i use this piece of code:

private async Task<byte[]> GetDropboxByteArrayAsync(Metadata item, string sharedLink)
{

DropboxClient client = new DropboxClient(DropBoxKey);
SharedLink sl = new SharedLink(sharedLink, null);
var file = await client.Sharing.GetSharedLinkFileAsync(sl.Url, "/" + item.Name, null);

var fileAsByteArray = await file.GetContentAsByteArrayAsync();

return fileAsByteArray;
}

Once I download the image from dropbox i keep it on a cache so i don't download the same image over and over again.

 I'm not sure if i'm approaching this the right way. All the request are using the same OAuth key. That's because the users don't want to log into their dropbox account all the time, that's the point of using the shared link.

The thing is, I'm getting the Rate Limit exception and i don´t know if it is by the number of users requesting images at the same time or the number of threads that I create for a single user.

¿How should I do this?

¿Do I need to generate new OAuths keys?

¿Do I need to keep the DropBoxClient instance and reuse it?

Thank you.

1 Reply 1

Greg-DB
Dropbox Staff

The API was designed with the intention that each user would link their own Dropbox account, in order to interact with their own files. However, it is technically possible to connect to just one account, as you've shown here.

We generally don't recommend doing so, for various technical and security reasons. For instance, the Dropbox API rate limiting system is built for the scenario where each user connects their own account. The rate limits operate on a per-Dropbox user account basis. 

So, if you run all of your users through your single Dropbox user account, you are more likely to run in to rate limits. There isn't a supported better way to do this via the API, such as registering more keys/tokens or re-using a client, since it's per-Dropbox user account.

One alternative may be to access the Dropbox shared link directly, using one of the URL parameters documented here. That way, you wouldn't be using the API and be subject to the API rate limits. You would still be subject to the shared link bandwidth limits though. In general though, it sounds like your use case may be better suited by a general CDN, as opposed to Dropbox.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?