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: 

How do I extract the url from sharing_get_shared_links?

How do I extract the url from sharing_get_shared_links?

babydream
Helpful | Level 6
Go to solution

I am stuck in getting the url from sharing_get_shared_links?   Been trying all day with no success.  I had no issue with the create_link but that also returns a slew of data which it has the url but much more complex than the get_shared_link. 

 

Help please, stuck in the mud.

 

shared_link_metadata = dbx.sharing_get_shared_links(path=save_product_path)
 
shared_link_metadata contains:
GetSharedLinksResult(links=[PathLinkMetadata(expires=NOT_SET, path='/Test_App/Beach Vibes (GO)/Beach Vibes - 6x8 - GO WEB.jpg',
visibility=Visibility('public', None))])
1 Accepted Solution

Accepted Solutions

babydream
Helpful | Level 6
Go to solution

I am using Python 3.11.   I finally figured out how to get to the url through trial and error.  Dropbox documentation on Python needs to be updated to explicitly state how the return values are processed.  Otherwise, it can be a nightmare.  I know you guys don't support language specifics on how to extract the parameter values but it would be nice to have this documented.  Thank you

 

 shared_link_metadata = sharing_get_shared_links(path=save_product_path)

        iterator = iter(shared_link_metadata.links)
        print(iterator)
        for item in iterator:
            shared_link = item.url

 

View solution in original post

2 Replies 2

Greg-DB
Dropbox Staff
Go to solution

The sharing_get_shared_links method returns a GetSharedLinksResult object which contains a 'links' field which is a list of LinkMetadata; on each of those you can access the 'url' field to get the URL.

 

So, the code to print out each URL would look like this:

for link in shared_link_metadata.links:
	print(link.url)

 

By the way, /2/sharing/get_shared_links is deprecated in favor of /2/sharing/list_shared_links, so please use sharing_list_shared_links instead of sharing_get_shared_links. The code for reading the URLs would work the same way.

babydream
Helpful | Level 6
Go to solution

I am using Python 3.11.   I finally figured out how to get to the url through trial and error.  Dropbox documentation on Python needs to be updated to explicitly state how the return values are processed.  Otherwise, it can be a nightmare.  I know you guys don't support language specifics on how to extract the parameter values but it would be nice to have this documented.  Thank you

 

 shared_link_metadata = sharing_get_shared_links(path=save_product_path)

        iterator = iter(shared_link_metadata.links)
        print(iterator)
        for item in iterator:
            shared_link = item.url

 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    babydream Helpful | Level 6
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?