cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Tell us what you want to see on the Community here!
Close

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: 

Using API to get a list of *direct* url's to images in a folder

Highlighted

Using API to get a list of *direct* url's to images in a folder

Explorer | Level 4

We're building an app in Python that will need to retrieve a list of every file in a particular folder containing jpg images, and for each image, we need to get a direct http url that can be used in an html img src tag.  We also need the original image file name (the name humans see when the view a list of files e.g. image1.jpg)

When testing the api using list_folder, we get back the original file names and other metadata like the file id.  But how do we create a url for each file?  

It seems like Dropbox is preventing or discouraging this practice perhaps to reduce load on their servers from people hosting images used on high-traffic sites.  But we're not doing that.

Thanks

 

2 Replies 2
Highlighted

Re: Using API to get a list of *direct* url's to images in a folder

Dropboxer

To get a direct link to a file via the API you can call the /2/files/get_temporary_link endpoint. In the official Dropbox API v2 Python SDK, that's available as files_get_temporary_link

Note that those links are only valid for four hours. If you need longer-lived links, you can instead use /2/sharing/create_shared_link_with_settingssharing_create_shared_link_with_settings. Those point to the HTML preview page by default, but you can modify them for direct access as documented in this help center article.

Also, be aware that these links are subject to the bandwidth limits documented here

Highlighted

Re: Using API to get a list of *direct* url's to images in a folder

Explorer | Level 4

Thanks!  

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?