Take Your Search Game to the Next Level with Dropbox Dash 🚀✨ Curious how it works? Ask us here!
Forum Discussion
Shilpa M.
9 years agoNew member | Level 1
Import Email shared file by api.
How can I Download file where I get shared file in mail.
Is there any method in api to get this link.
12 Replies
Sort By
- Greg-DB
Dropbox Staff
I'm not sure I understand your question. Can you clarify? Thanks in advance!
- Shilpa M.New member | Level 1
I am using API v2 and I have problem in file download. When I shared a file with any user through email and user copy that url from the mail and paste it in url column in method
2/sharing/get_shared_link_metadata
method it return an error
shared_link_not_found
In email user got link from "View Files" button
Please suggest.
- Greg-DB
Dropbox Staff
Unfortunately the exact link in the email itself isn't a supported format for this endpoint. You'll need to follow the redirect on that link to expand it to the expected format, which would look like this:
- john b.226New member | Level 1
When I try this, the redirect is a much longer URL, and pasting that into the
API explorer here:
https://dropbox.github.io/dropbox-api-v2-explorer/#sharing_get_shared_link_metadata
also fails to work.
This appears to be a hole in the documentation. If someone shares a file with me,
I can see it in the results of the /2/sharing/list_received_files API (when authenticating
with a Bearer token).
But I can't find any way to then programmatically download that file.
- Greg-DB
Dropbox Staff
Hi John, can you elaborate on what you mean when you say it "fails to work"? What error are you getting?
The get_shared_link_metadata functionality in the API Explorer seems to be working for me:
Can you share the code and error, or a screenshot showing the issue?
Note that if you want to download the file content, you can use /2/sharing/get_shared_link_file if it's a link to a file, or modify the link as shown here and download from the modified link directly, for either folder or file links.
- john b.226New member | Level 1
Hi Gregory,
Sorry, I should have explained this better.
I've shared a file with myself (using a different email account) by clicking on the "Share"
button, and filling in my email address. The automatic email then sent by Dropbox is here:
What I'm trying to do is go from that email (rather than a user-created email with a shared
link pasted in manually, which works fine, but requires an extra step on the part of the user) to a download link.
The "View file" URL ( https://www.dropbox.com/l/scl/w9txMqmTNk4RBqzjpmWuZj?text=3D1 ) embedded in the email above does not work with the get_shared_link_metadata API, whether
or not I remove the "text=3D1" or add "&dl=1" from/to the query.
So the step I'm missing is how to go from that URL to one that *will* work with the API.
I can of course click on the link manually and get the download page etc.; the point is
to be able to do this from a scripted email client. I put some effort into parsing
the web page that the emailed link leads to, and tracing the javascript to see if/where
a API-usable link is being generated, but I failed.
Thanks,
John
- Greg-DB
Dropbox Staff
Thanks for elaborating John! This is related to the issue I was referring to in my comment earlier in this thread on May 4.
To expand on that though, the links included in emails like this aren't intended for programmatic consumption, but to do so, you'd need to make a normal HTPT GET request to it first to get the supported version. The response should be a redirect with a "Location" header containing the redirected address.
Also, note that there are different kinds of sharing in Dropbox, as well as different access controls, so I can't guarantee this will always work. For example, the sample link you included is intended for a specific recipient, so that access control will prevent you from doing exactly what you want via the API unfortunately.
- john b.226New member | Level 1
Hi Greg,
Thanks for the reply. When I follow the link received in the email from dropbox, logging all requests in my browser's debugging console until I get to my browser's View/Save download dialogue, I don't see any requests that begin with
(and there are none in the parsed html from the redirected page).
John
- Greg-DB
Dropbox Staff
Thanks for checking that John. Also, for reference since I didn't mention it earlier, /sh/ is for folders, and /s/ is for files.
If those aren't the types you're trying to use, unfortunately I'm afraid this is an unsupported sharing flow for the API. Apologies I can't be of more help!
- john b.226New member | Level 1
Hi again Greg
It seems that there's no documented way to do what I want to do.
As a new user, and someone who will be receiving files from other new users, I'm surprised that:
- the most obvious way (to me) to share a file from the web interface seems to be to hit the Share button to the right of a file, fill in an email address in the pop-up dialog, then hit Share there, as in this screenshot:
- the email sent by Dropbox to me when someone does (1) has no documented way to be processed by a scripted email client. (i.e. it works fine if I'm manually reading the email and clicking on links in a web browser, but I can't see how to automate it)
- if instead, the user clicks on the create a link and manually copies/pastes that link into an email to me that they compose in their email client, I can easily parse the link and
automate file download using the V2 API.
Sorry if I'm being obtuse, but it seems the process could be made simpler and less surprising
if step (1) generated an email from dropbox.com that contained a link I could handle automatically as in step (3).If I've missed something in your explanation, please elaborate. If not, is there a way to file
this as a feature request?
Thanks!John B
- the most obvious way (to me) to share a file from the web interface seems to be to hit the Share button to the right of a file, fill in an email address in the pop-up dialog, then hit Share there, as in this screenshot:
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,989 PostsLatest Activity: 2 days ago
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!