We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Mhd
8 years agoExplorer | Level 4
Distinguish shared link and preview links
Am I correct to assume the following: a shared link will alawys have /s/ in the URL The original preview link is of the from : www.dropbox.com/home/path/to/file?preview=filename.pdf What I a...
Greg-DB
Dropbox Community Moderator
8 years agoDropbox shared links for files do currently have /s/, but there are other kinds of links. E.g., shared links for folders use /sh/.
In any case though, these link formats are not guaranteed and are subject to change in the future, so you shouldn't rely on them.
Likewise, you shouldn't rely on the "www.dropbox.com/home/path/to/file?preview" format.
You can list the files/folders in your account directly though, using list_folder and list_folder continue. That will return file metadata including path and id.
Using the paths you get from those, you can call the other methods as necessary, e.g., get_preview to get preview data, create_shared_link_with_settings to create shared links, list_shared_links to retrieve existing shared links, etc.
In any case though, these link formats are not guaranteed and are subject to change in the future, so you shouldn't rely on them.
Likewise, you shouldn't rely on the "www.dropbox.com/home/path/to/file?preview" format.
You can list the files/folders in your account directly though, using list_folder and list_folder continue. That will return file metadata including path and id.
Using the paths you get from those, you can call the other methods as necessary, e.g., get_preview to get preview data, create_shared_link_with_settings to create shared links, list_shared_links to retrieve existing shared links, etc.
Mhd
8 years agoExplorer | Level 4
Hello Greg,
Thanks for the detailed answer.
I tried to go with with list_folder and list_folder/continue. But there are thousnads of files and it was not practical.
Also, sometimes a user have a sharing link but the file is not shared with their dropbox account, they only have the public sharing link, so I can't use this option.
It would be great if there was a way to get the meta data of a file through a link , despite what kind of link it is.
For now, I will relay on get_shared_link_metadata and if it failesI will assume it is a preview link and parse it accorrdingly.
and I will limit URLs I have to sharing links only from now on.
Thanks again for your answer, please let me know if there is an easier approach
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!