cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in hearing how one of our Community members uses Dropbox for sailing trips? Read all about it here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Import Email shared file by api.

Import Email shared file by api.

Shilpa M.
New member | Level 1

How can I Download file where I get shared file in mail.

Is there any method in api to get this link.

 

12 Replies 12

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:

https://www.dropbox.com/sh/abcdefgh/AiBjCkDlEmFnGoHp

john b.226
New 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.226
New 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:

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

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.226
New 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

    https://www.dropbox.com/sh/

(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!

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    john b.226 New member | Level 1
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?