cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Musicians, convert your MuseScore files to PDF to play music on the go! Learn more 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: 

Does sharing_create_shared_link_with_settings create new link every time?

Does sharing_create_shared_link_with_settings create new link every time?

vsipchenko
Explorer | Level 4
Go to solution

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?

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

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.

View solution in original post

5 Replies 5

Greg-DB
Dropbox Staff
Go to solution

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.

kevin g.1
Helpful | Level 6
Go to solution

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?

Greg-DB
Dropbox Staff
Go to solution

@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.

kevin g.1
Helpful | Level 6
Go to solution

Hi,

   Thanks for the helpful response. Are those cases where the metadata isn't returned documented?

Greg-DB
Dropbox Staff
Go to solution

@kevin g.1 No, unfortunately the cases for when the existing shared link metadata will or will not be returned are not documented/guaranteed.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    kevin g.1 Helpful | Level 6
What do Dropbox user levels mean?