Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I am using python SDK and looking at 2 different methods:
1. sharing_create_shared_link
2. sharing_create_shared_link_with_setting
So from documentation I see that first method returns previously created shared link if it already exists, and creates it if it is not. Does the second method work the same, or it create a new link every time?
No, sharing_create_shared_link_with_settings does not work the same way. If you call it for a path for which there is already a shared link, it will give a CreateSharedLinkWithSettingsError.shared_link_already_exists error. In that case, you can call sharing_list_shared_links with direct_only=True to retrieve the existing link.
No, sharing_create_shared_link_with_settings does not work the same way. If you call it for a path for which there is already a shared link, it will give a CreateSharedLinkWithSettingsError.shared_link_already_exists error. In that case, you can call sharing_list_shared_links with direct_only=True to retrieve the existing link.
Hi Greg,
Is it possible to emulate the behavior of the deprecated sharing_create_shared_link method where the existing shared link is returned by default instead of having to catch the error and make another api call to list the existing shared links?
@kevin g.1 It's not possible to recreate the sharing_create_shared_link behavior with sharing_create_shared_link_with_settings exactly, but in some cases the API will return the existing shared link metadata in the SharedLinkAlreadyExistsMetadata in the CreateSharedLinkWithSettingsError, which you can get via CreateSharedLinkWithSettingsError.get_shared_link_already_exists to streamline the process. If not though, you do still need to make the extra API call.
Hi,
Thanks for the helpful response. Are those cases where the metadata isn't returned documented?
@kevin g.1 No, unfortunately the cases for when the existing shared link metadata will or will not be returned are not documented/guaranteed.
Hi there!
If you need more help you can view your support options (expected response time for a 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!