We Want to Hear From You! What Do You Want to See on the Community? Tell us here!
Forum Discussion
alekso89
30 days agoHelpful | Level 7
Get / Make Public and Temporary link for files
Hi everyone!
I use the API https://content.dropboxapi.com/2/files/upload to upload files. After uploading, I get the file ID.
I'm trying to figure it out, but it doesn't work out, how do I get public and temporary links to uploaded files?
By public links, I mean that anyone who has this link can see them indefinitely.
Under temporary - everyone can see it, but for a limited time after which this link will no longer be available. It is necessary for the link to operate for a configurable time, for example, 90 seconds.
All files are saved to a shared command folder, not to a personal account folder.
The users who will receive these links are not Dropbox users.
Thanks!
9 Replies
- DF-Dropbox22 days ago
Community Manager
alekso89 If this workaround is producing the results you want, it seems like we're all good here.
Please let us know if there's anything else!
- alekso8923 days agoHelpful | Level 7
Hi Jay
I am using the create_shared_link_with_settings API to get the link. After receiving the link, I make substitutions in the URL as indicated in the screenshot. It is quite a working option to get a direct link, without a redirect.
Is this option acceptable for Dropbox?
- Jay23 days ago
Dropbox Community Moderator
HI alekso89, in order to understand what you're requesting, please could you provide more information on what you're looking for, as you mentioned that everything works on your end after changing the URL?
Are you also using an API app to create these links, or are you going to be doing these changes manually?
- alekso8926 days agoHelpful | Level 7
I hope someone will answer me.
- iNeil27 days ago
Dropbox Community Moderator
Hi alekso89,
You are correct that adding "raw=1" to the URL of a shared link will cause an HTTP redirect. The "raw=1" query parameter is used to bypass the preview page and allow your browser to directly render the file.In relation to replacing www.dropbox.com with dl.dropboxusercontent.com, I’ve moved this forum post to the Create, Upload, and Share section to better assist with your inquiry with the shared link.
- alekso8928 days agoHelpful | Level 7
Hi iNeil,
I'm not interested in downloading files yet. At the moment, I need to display an image without a viewer, directly. The parameter in the URL string "raw=1" will give an extra redirect, which is not exactly good for me.
I read that we can replace www.dropbox.com -> dl.dropboxusercontent.com and everything will work, I checked, everything works. In fact, "raw=1" and what I tried are the same thing, but there is no redirect in the second option.
- iNeil28 days ago
Dropbox Community Moderator
Hi alekso89,
If you would like to download a file directly from a shared link, you can achieve this action by including the dl=1 parameter in the shared link. For further information, please review the following link:
- How to force a shared link to download or renderThat said, you should avoid modifying shared links beyond the documented parameters outlined in our help center article. Making other modifications can corrupt the link and cause it to fail.
- alekso8929 days agoHelpful | Level 7
As I see that API generate url to the file with Dropbox Preview -> https://www.dropbox.com/scl/fi/6rapn1stbhzgdgfssat0k/m6fb351dfde2815207775f32e27123e2059bf75a5104726156m35c6f8ef57c18-6.jpg?rlkey=6y1gsy6tb93s7zc3gjluedl1v
What about if I change www.dropbox.com -> dl.dropboxusercontent.com for getting direct image without preview? It will be working correct? - iNeil29 days ago
Dropbox Community Moderator
Hello alekso89
Based on the information you’ve provided, you can create a Dropbox shared link after the file has been successfully uploaded to your account.
Using the Dropbox API, you can call the /2/sharing/create_shared_link_with_settings endpoint to generate the shared link. This endpoint also allows you to customize the link’s settings, such as its access level and expiration time. For more details, please refer to the following guide:
- Dropbox Sharing Guide
About Create, upload, and share
Find help to solve issues with creating, uploading, and sharing files and folders in Dropbox. Get support and advice from the Dropbox Community.
Need More Support
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or 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!