Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Babaraba Abdabi
3 years agoExplorer | Level 4
I want to obtain the URL of a file on Dropbox via an API.
I want to get the URL of the file for users with the appropriate access permissions to the file. This is not about the shared link URL. Is there an API to get the URL of a file on Dropbox? Or is the...
Babaraba Abdabi
3 years agoExplorer | Level 4
Thank you for your reply.
I understand that there is no API to obtain the URL for direct access (not sharing url).
In that case, I am considering a way to construct a link URL from the file path. Can I assume that all can be accessed from under `/home/` ?
example)
```
lower_path = "/foo/bar/baz/something.pdf"
dirname = File.dirname(lowerpath) # /foo/bar/baz
basename = File.basename(lowerpath) # something.pdf
"https://www.dropbox.com/home#{dirname}?preview=#{basename}"
```
Здравко
3 years agoLegendary | Level 20
Babaraba Abdabi wrote:...
"https://www.dropbox.com/home#{dirname}?preview=#{basename}"
...
Hi Babaraba Abdabi,
Such a link may appear valid for file, but take in mind that it's very context specific (login session specific). You should make sure the user has logged in the same context where you got your dirname/basename from. Otherwise the link could appear invalid or even worse - link may be valid but pointing something completely different (something that's difficult to trace).
You may got confused from Greg's proposal for usage of /2/sharing/create_shared_link_with_settings. In spite part of 'sharing' family of calls, while set 'no_one' as audience, this link appear absolutely equivalent to the your proposal, except it doesn't depend on the context (i.e. much more stable and not shared one in fact - despite of the 'family' - you're sharing to 'no_one'). 😉
Hope this clarifies matter.
Add: Something else you may be interested in. Instead of creating new link, you can get a link every file has already. Just call /2/sharing/get_file_metadata to a file of interest (either shared or not). In the result's filed 'preview_url' you will receive preexisting link of type 'no_one'.
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!