cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We are making some updates so the Community might be down for a few hours on Monday the 11th of November. Apologies for the inconvenience and thank you for your patience. You can find out more here.

Discuss Dropbox Developer & API

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

Retrieve a public link in the dl.dropbox.com format, not www.dropbox.com

Retrieve a public link in the dl.dropbox.com format, not www.dropbox.com

ultralame
Explorer | Level 3

Hello,

 

I am using Dropbox as a halfway point to upload files to a third party service.  They don't provide upload capability via their API, rather I need to provide a publicly accessible URL with my request and their systems will retrieve that file.  So dropbox works.

 

If my dropbox URL is of the format https://dl.dropbox.com/file.ext all is well.  Their system retrieves the file and is able to process the type correctly on their side.

 

Unfortunately, if I provide https://www.dropbox.com/file.ext?dl=1 the file is imported, but their system chokes on the type, which I apparently cannot modify afterwards.

 

so the trick here is that I want to retrieve the link to DB in the dl.dropbox.com/file.ext format.

At the moment, I am calling create_shared_link_with_settings and then following up with list_shared_links (to avoid the error if the link already exists, bad code, I know.  I'll eventually fix it).

But the shared link is www.dropbox.com/file.ext, not dl.dropbox.com/file.ext

So I am modifying the link in code.  I do not like this.  I know that dl will probably not go away... but...

So is there any way to request the dl.dropbox.com link directly?

5 Replies 5

Здравко
Legendary | Level 20

Hi @ultralame,

You are converting initial link to download link. Seems like Dropbox serve all downloads as binary data (doesn't matter actual type). One simple solution is instead of converting to download link to convert the link to raw link (replace '?dl=0' to '?raw=1'). If your target service require download (i.e. inspects HTTP 'content-disposition' header), then you can use temporary link. 😉 In both cases content type is guessed correctly (typically).

Good luck.

Greg-DB
Dropbox Staff

No, the Dropbox API does not offer a way to retrieve shared links with that hostname. (Also, note that while it may technically work, using 'dl.dropbox.com' like that is not officially supported/documented. The officially supported modifications are documented here.)

 

If your use case would be met with temporary links though, I suggest trying out /2/files/get_temporary_link (or corresponding native SDK method) as those returned links do point directly to file data.

ultralame
Explorer | Level 3

Thanks.  I tried the temporary link, and it didn't work either.

Здравко
Legendary | Level 20

@ultralame, Ask the target service what's the issue! Here we only can try guess. If the expectation is filename within URL, unfortunately it's impossible. In such a case check if there is an option they use the name in corresponding header (as is normally done by every browser, for instance).

ultralame
Explorer | Level 3

The target service is not interested in fixing their issue.  I know.  It's not my choice.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    ultralame Explorer | Level 3
  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?