Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Giorgio C.3
10 years agoNew member | Level 1
Writing a file via API and make it always accessible publicly (like the old Public folder)
Hi,
This is my scenario: I need to write a file in users' Dropbox using the Core API and make it accessible (sharable) publicly and for a longer period (than 4 hours). I need somehow a similar behavior to the old Public folder, when the public link was available forever. I have noticed that if users share something via the "Share Dropbox link" they can set the expiration date or even remove it, but I cannot find a similar option via API.
So far, I am able to make the authentication, etc. and write anywhere/anything in a user's dropbox via the Core APIs but I cannot figure out how to make a file (or a folder) always accessible. The media API seems the closest way, but it expires after 4 hours.
Is there a way to do this?
Thanks so much!
Giorgio
6 Replies
Replies have been turned off for this discussion
- Greg-DB10 years ago
Dropbox Community Moderator
Yes, you can use the /shares endpoint to get a shareable link to a file or folder:
- Giorgio C.310 years agoNew member | Level 1
Thanks, Gregory
I would like to access the raw version of the file (which will be a JSON file). Is there a way to do that via API? I have noticed that the /media links expire after 4 hours...
- Greg-DB10 years ago
Dropbox Community Moderator
Yes, there's information here on modifying the links from /shares for different behaviors, e.g., to return raw content:
https://www.dropbox.com/help/201
- Giorgio C.310 years agoNew member | Level 1
That's great, thank you so much!
The only downside of this is that the /shares link is not CORS enabled like the APIs, right? Having that &raw=1 option in the /shares endpoint would be great...
- Greg-DB10 years ago
Dropbox Community Moderator
That's correct, CORS isn't enabled on www.dropbox.com. The parameters (
dlorraw) are preferred, but if they don't suit your use case, one alternative is to change host from www.dropbox.com to dl.dropboxusercontent.com, that is:to:
dl.dropboxusercontent.com/s/...
CORS does work on the latter host. That's not documented though, so I can't say it's officially supported.
And thanks for the feedback. I'll pass this along as a request to put the raw option directly into the /shares endpoint.
- Giorgio C.310 years agoNew member | Level 1
Awesome!
Thank you again for your help!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
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, Facebook or Instagram.
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!