You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
Slawek
8 years agoNew member | Level 2
shared_link_already_exists just after list_shared_links returned nothing
I maintain an application which uploads files submitted by users and creates a shared link to them.
In most cases it works properly, but today one call to create_shared_link_with_settings returned 409 with the message shared_link_already_exists
It happened few hundred miliseconds after I called list_shared_links and received nothing.
Is there any reasonable explanation to this phenomena?
- Greg-DBDropbox StaffWhile it's technically possible the race condition occurred in this case (i.e., the link was created by some other client in between your two calls to list_shared_links and create_shared_link_with_settings), that is relatively unlikely given the short time span you indicated.
Is it possible your app called create_shared_link_with_settings twice somehow though? E.g., as an automatic retry in response to a network failure? That could cause this.
In any case though, you should implement error handling in your app for the shared_link_already_exists error, regardless of the timing of a previous call to list_shared_links.- SlawekNew member | Level 2
I call list_shared_links and create_shared_link_with_settings in the same function, so the first should discover any shared links created earlier, no matter how. That's my idea for this code ;).
In fact I have added this option only as a precaution, because the same function also uploads the file with autorename, so I don't expect any shared link for this file to exist.
Unless this error can be caused by sharing of the parent folder. Of course it would still be a race condition, which is very unprobable .
Is it possible to get shared_link_already_exists on the file just because a parent folder is shared?
- Greg-DBDropbox Staff
Even though you call list_shared_links and create_shared_link_with_settings in the same function, there's still a race condition between the two calls, so you should make sure your call to create_shared_link_with_settings can always handle the possibility of a shared_link_already_exists error.
No, having a parent folder shared wouldn't cause a shared_link_already_exists error for a file in that folder.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 12 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!