We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
Itai M.
3 years agoExplorer | Level 4
createSharedLinkWithSettings() falls with shared_link_already_exist error
We're using the following code to create shared links:
sharingClient: DbxUserSharingRequests
sharingClient.createSharedLinkWithSettings(path)
DroboxCore SDK version: 5.1.1
Request ID:
aa92c91cb979457d85ffa03c89a6c4d0
b54e559b95224839a25673ad461de91f
41011827be2a495c897617aa2c2b5a23
042a000666cb4e1d81722459ad4ce27a
339205393d704ecc81389bdf845a3e7c
2fbe2808ee604453806e8bea59a030a1
Error:
com.dropbox.core.v2.sharing.CreateSharedLinkWithSettingsErrorException: Exception in 2/sharing/create_shared_link_with_settings: {".tag":"shared_link_already_exists","shared_link_already_exists":{".tag":"metadata","metadata":{".tag":"file","url":"https://www.dropbox.com/s/hsk98qywlluod1l/mb_tbm_bogo_sawi-48d-treadmill-stories-testboosttahe22-bogo_visa.mov?dl=0","name":"mb_tbm_bogo_sawi-48d-treadmill-stories-testboosttahe22-bogo_visa.mov","link_permissions":{"can_revoke":true,"resolved_visibility":"public","requested_visibility":"public"},"client_modified":"2022-04-04T15:13:04Z","server_modified":"2022-04-04T17:23:42Z","rev":"5dbd763cdaea07ecc7ab1","size":8076679,"id":"id:9gZdgY3Xx4wAAAAAAAAkbw","path_lower":"/media buying main/sculptnation/test boost ads/sam/tb_sawi-048/mb_tbm_bogo_sawi-48d-treadmill-stories-testboosttahe22-bogo_visa.mov"}}} at com.dropbox.core.v2.sharing.DbxUserSharingRequests.createSharedLinkWithSettings(DbxUserSharingRequests.java:481) at com.dropbox.core.v2.sharing.DbxUserSharingRequests.createSharedLinkWithSettings(DbxUserSharingRequests.java:502) at
Can you please check what causes this failure and suggest the proper way to handle this.
Thanks.
- Greg-DBDropbox Staff
Itai M. That's correct, if there's already a shared link for the item, you'll get that 'shared_link_already_exists' error. You can catch and handle that exception as needed. You can also use listSharedLinks to check for/list existing shared links.
- ЗдравкоLegendary | Level 20
Itai M. wrote:...
Can you please check what causes this failure and suggest the proper way to handle this.
...
Hi Itai M.,
🙂 You question is little bit philosophical. Main subpart of your question could be is there some failure at all?!
In general software exception is a way some function/method (or generally code piece) to return alternative result to calling code. What will be this alternative result? 🤔 Could be anything. Very common is such result to be used as error/failure signal, but this is not mandatory. Interpretation of such alternative result is matter of context. 😉
In your particular case the "failure" is preexistence of the link your are trying to create. Is this a real failure or something acceptable? 🧐 It depends on your application design (i.e. your desire).
How can you handle that? If according to your initial idea preexistence of such link is unexpected..., one way is to signal to the user, for example. Otherwise, you can catch the exception and pop wanted result out from there - there is a "metadata" field matching exactly the normal result when this type of exception gets catch (from that point on you can continue normal application flow). 😉 So finally... the choice is yours.
Hope this helps.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 3 hours 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!