Discuss Dropbox Developer & API
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?
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.
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.
Thanks. I tried the temporary link, and it didn't work either.
@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).
The target service is not interested in fixing their issue. I know. It's not my choice.
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!