How can I Download file where I get shared file in mail.
Is there any method in api to get this link.
I'm not sure I understand your question. Can you clarify? Thanks in advance!
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
<SPAN><SPAN><SPAN class="hljs-number">2</SPAN>/sharing/get_shared_link_metadata </SPAN></SPAN>
method it return an error
<CODE><SPAN class="hljs-value"><SPAN class="hljs-string">shared_link_not_found</SPAN></SPAN>
In email user got link from "View Files" button
Please suggest.
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:
https://www.dropbox.com/sh/abcdefgh/AiBjCkDlEmFnGoHp
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.
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.
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:
http://pastebin.com/3VarM5n0
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
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.
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
https://www.dropbox.com/sh/
(and there are none in the parsed html from the redirected page).
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!
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:
Sorry if I'm being obtuse, but it seems the process could be made simpler and less surprisingif 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 filethis as a feature request?Thanks!
John B
Thanks for the feedback John! It looks like you have this correct, so I'm sending this along as a feature request for support for this flow.
Great - thanks for your patience, Gregory.