cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Getting error on shared_link_metadata = dbx.sharing_create_shared_link_with_settings

Getting error on shared_link_metadata = dbx.sharing_create_shared_link_with_settings

babydream
Helpful | Level 6

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')))

3 Replies 3

Здравко
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.

Greg-DB
Dropbox 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.

babydream
Helpful | 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

Need more support?