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
limeygent
6 years agoExplorer | Level 3
HTTP API Throttling?
Hi, I am using the http API to upload files into my account, however >50% of them fail and I suspect it is because I can have up to 20 parallel processes trying to upload in a window of about 5 secon...
Greg-DB
Dropbox Staff
This can happen when attempting to upload multiple files at once. The 'too_many_write_operations' error indicates "lock contention". That's not explicit rate limiting, but rather a result of how Dropbox works on the backend. This is a technical inability to make a modification in the account or shared folder at the time of the API call. This error indicates that there was simultaneous activity in the account or shared folder preventing your app from making the state-modifying call (e.g., adding, editing, moving, or deleting files/folders) it is attempting. The simultaneous activity could be coming from your app itself (as in this case when uploading multiple files in parralel), or elsewhere, e.g., from the user's desktop client. It can come from the same user, or another member of a shared folder. You can find more information about lock contention here:
https://www.dropbox.com/developers/reference/data-ingress-guide
In short, to avoid this error, you should avoid making multiple concurrent state modifications. E.g., don't issue multiple such requests at a time, and use batch endpoints whenever possible. That won't guarantee that you won't run in to this error though, as contention can still come from other sources, so you may also want to implement automatic retries in your app.
limeygent
6 years agoExplorer | Level 3
Thanks Greg.
I'm just now learning Dropbox's API. What are the endpoints for batch upload? Is it the upload_session EP? If there are some code samples, that would be great. Thanks.
- Greg-DB6 years agoDropbox Staff
In order to use the batch upload finish endpoint, you do need to use upload sessions. The relevant endpoints are:
- https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-start
- https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-append
- https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-finish_batch
- https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-finish_batch-check
I don't believe we have a sample for using upload sessions with /2/files/upload_session/finish_batch, but there are some examples of just using upload sessions (with some of the SDKs) here, which should be a good starting point for the logic:
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,875 PostsLatest Activity: 2 months agoIf 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!