Forum Discussion

denrev's avatar
denrev
New member | Level 2
8 years ago

Traverse a shared folder

Given a shared link (ie https://www.dropbox.com/sh/koc0ymsn8lxk2sh/AAAS28iWSscFFzg3u6bZ6QB7a?dl=0) from the account I don't own, my goal is to produce a list of download links for the files inside the given folder and later download them. Note that I don't want a zip of the folder - customer UX would allow to unselect separate files and I want to download selected only (so `?dl=1`) doesn't work for me.

 

I can list items inside the folder with https://dropbox.github.io/dropbox-api-v2-explorer/#files_list_folder. Each item has an ID (ie id:jbYYPFO7EXYAAAAAAATVmn) and a `parent_shared_folder_id` (ie 1498401). I also have names of the files inside.

 

- sharing_get_file_metadata returns "invalid id" for amy ID I get 

- sharing_get_folder_metadata also fails with `parent_shared_folder_id` fetched above

- I tried to `mount` the folder.

 

There is literally no way to do anything with information from `list_folder`. 

 

How can I get download links for files shared with me inside a folder?

 

Thanks!

 
[Note: I mangled links on purpose and they are just to indicate the format of the link I use]

4 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago

    When using /2/files/list_folder to list the contents of a folder via a shared link like this, the intent is that you can use the resulting paths for the files/folders under that folder with /2/sharing/get_shared_link_file and/or /2/sharing/get_shared_link_metadata, i.e., by supplying the `url` and `path` (relative to the folder) to get the child file or metadata. (The get_file_metadata and get_folder_metadata endpoints are for different types of sharing, so they don't apply here.)

     

    The /2/sharing/get_shared_link_file endpoint will let you get the file data directly, but there isn't a way to get a shared link for the nested file unfortunately. I'll send this along to the team though to see if we can get that added in the future.

  • denrev's avatar
    denrev
    New member | Level 2
    8 years ago

    Direct access to the binary is great, this works for the second step I want to do - thanks!

    For the first step, I would still need a direct link and thumbnail if possible to render it properly. For now the solution is to construct a URL of kind `?dl=0&preview=<filename>` to have the links.

    Ability to have to download links will be much appreciated - looking forward for it!

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago
    Thanks for following up. To clarify though, I've sent this request along to the team, but I can't guarantee if or when that would be implemented.
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    5 years ago

    Update: The Dropbox API now returns the shared link for the nested item as 'url' when requesting the metadata for that item using the "path" parameter on /2/sharing/get_shared_link_metadata (instead of the original parent link).

About Dropbox API Support & Feedback

Node avatar for 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!