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
babydream
2 years agoHelpful | Level 6
Getting error on shared_link_metadata = dbx.sharing_create_shared_link_with_settings
I have this code working in my development environment, but it will not work using our production environment. I 've created a branding as specified in the documentation. The scoped apps are identical. Am I missing something? The shared linked retrieved is correct.
Here's the exception I am getting:
CreateSharedLinkWithSettingsError('shared_link_already_exists', SharedLinkAlreadyExistsMetadata('metadata', FileLinkMetadata(client_modified=datetime.datetime(2022, 5, 26, 19, 44, 45), content_owner_team_info=NOT_SET, expires=NOT_SET, id='id:Fpt6TPwBUf0AAAAAAAA-PA', link_permissions=LinkPermissions(allow_comments=True, allow_download=True, audience_options=[LinkAudienceOption(allowed=True, audience=LinkAudience('public', None), disallowed_reason=NOT_SET), LinkAudienceOption(allowed=True, audience=LinkAudience('team', None), disallowed_reason=NOT_SET), LinkAudienceOption(allowed=True, audience=LinkAudience('password', None), disallowed_reason=NOT_SET), LinkAudienceOption(allowed=True, audience=LinkAudience('no_one', None), disallowed_reason=NOT_SET)], can_allow_download=True, can_disallow_download=True, can_remove_expiry=True, can_remove_password=True, can_revoke=True, can_set_expiry=True, can_set_password=True, can_use_extended_sharing_controls=NOT_SET, effective_audience=NOT_SET, link_access_level=NOT_SET, requested_visibility=RequestedVisibility('public', None), require_password=NOT_SET, resolved_visibility=ResolvedVisibility('public', None), revoke_failure_reason=NOT_SET, team_restricts_comments=False, visibility_policies=[VisibilityPolicy(allowed=True, disallowed_reason=NOT_SET, policy=RequestedVisibility('public', None), resolved_policy=AlphaResolvedVisibility('public', None)), VisibilityPolicy(allowed=True, disallowed_reason=NOT_SET, policy=RequestedVisibility('team_only', None), resolved_policy=AlphaResolvedVisibility('team_only', None)), VisibilityPolicy(allowed=True, disallowed_reason=NOT_SET, policy=RequestedVisibility('password', None), resolved_policy=AlphaResolvedVisibility('password', None))]), name='Beach Vibes - 6x8 - GO WEB.jpg', path_lower='/test_app/beach vibes (go)/beach vibes - 6x8 - go web.jpg', rev='602ac30fc00f96a49d3d3', server_modified=datetime.datetime(2023, 8, 11, 21, 13, 59), size=1251420, team_member_info=TeamMemberInfo(display_name='Spencer Treadwell', member_id='dbmid:AAD0RjvblA75FwxwxOysVcw5sM1X7rbEfXw', team_info=Team(id='dbtid:AABwTGjgmzPm2JVb_S_Pf5GBZ0wgZwZ2J9w', name='baby dream')), url='https://www.dropbox.com/s/pexagwz8il76t1k/Beach%20Vibes%20-%206x8%20-%20GO%20WEB.jpg?dl=0')))
- Greg-DBDropbox Staff
babydream Yes, as Здравко said, a 'shared_link_already_exists' error from sharing_create_shared_link_with_settings indicates that the call failed because a link already exists for that file. As for why it fails in one environment and not the other, check which account(s) you're calling in each. If you're connected to the same account in both, the first call may work and the second may fail, since the link was created by the first call, for example.
You can get the existing link from the error if it is included there, otherwise you can call sharing_list_shared_links.
- babydreamHelpful | Level 6
Thanks for the feedback. I did notice that the link was included in the error message. I was just surprised when using my development id compared to using the production id I am getting different results. I can run in development the same code over and over without a problem. So now in the exception I need to extract the link.
Thanks again,
Cris
- ЗдравкоLegendary | Level 20
Hi babydream,
Yes, link to a file/folder can be created single time only. When try again, you get back error showing that link exists. In many cases, like yours, the actual link comes together with the error and you may fetch it out from there (take a look here for example how can be done). If the link doesn't accompany the exception, you should take list of shared links while pointing desired file/folder to get direct link (this is missing in the referred example).
Hope this helps.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,915 PostsLatest Activity: 6 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!