Forum Discussion

denrev's avatar
denrev
New member | Level 2
7 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]

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    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

      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 Staff rankDropbox Staff
        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.