cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more 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: 

Cannot call filesDownload for entries in a sharedLink to a folder (get path_not_found)

Cannot call filesDownload for entries in a sharedLink to a folder (get path_not_found)

elsigh
Helpful | Level 5
Go to solution

 

My use case is that I have a sharedLink to a folder where I'm not the owner and I'd like to build a little viewer for the contents of the that folder. I can get the list of files in a folder but not their contents. I believe I could accomplish this with a scraper, so it'd be nicer to do this in the API (and even without an access token at all since it's publicly accessible)

 

The URL to the sharedLink folder is: https://www.dropbox.com/sh/1dj7xiu7s0kgqoo/AADQjza7GmZlOFZk9pk0KHVda?dl=0 

I can open that incognito and see the files and download their contents in a browser.

 

REPRO - You can repro this as the not-folder-owner (aka anyone can repro this)

 

1) In the Dropbox API explorer get an access token

 

2) Call sharingGetSharedLinkMetdata with a sharedLink URL

https://dropbox.github.io/dropbox-api-v2-explorer/#sharing_get_shared_link_metadata

Set url: https://www.dropbox.com/sh/1dj7xiu7s0kgqoo/AADQjza7GmZlOFZk9pk0KHVda?dl=0 

 

3) Returns a folder with id id:zY8_f7IMoCgAAAAAAAIRmw

 

4) Call filesListFolder with that sharedLink url

https://dropbox.github.io/dropbox-api-v2-explorer/#files_list_folder

Open the shared_link (optional) disclosure thing and paste in the url:

https://www.dropbox.com/sh/1dj7xiu7s0kgqoo/AADQjza7GmZlOFZk9pk0KHVda?dl=0

 

That returns a response with a entries ala:

{
  "entries": [
    {
      ".tag": "file",
      "name": "Papa Smurf.pro",
      "parent_shared_folder_id": "37786917",
      "id": "id:zY8_f7IMoCgAAAAAAAIRnQ",
      "client_modified": "2020-04-28T14:20:44Z",
      "server_modified": "2020-04-28T14:20:45Z",
      "rev": "5a45a8994a4ed02409525",
      "size": 94,
      "sharing_info": {
        "read_only": true,
        "parent_shared_folder_id": "37786917",
        "modified_by": "dbid:AAC7xJh2VcDvncsSSMKnV9xJNEFqtltu0i4"
      },
      "is_downloadable": true,
      "content_hash": "ddb599aaa5b2783c61da68e567979f62a36559fc1d46a2bdfc2641a055c3b1ad"
    },
    {
      ".tag": "file",
      "name": "Papa Smurf 2.pro",
      "parent_shared_folder_id": "37786917",
      "id": "id:zY8_f7IMoCgAAAAAAAIRnw",
      "client_modified": "2020-04-28T15:54:59Z",
      "server_modified": "2020-04-28T15:55:01Z",
      "rev": "5a45bdaae036402409525",
      "size": 86,
      "sharing_info": {
        "read_only": true,
        "parent_shared_folder_id": "37786917",
        "modified_by": "dbid:AAC7xJh2VcDvncsSSMKnV9xJNEFqtltu0i4"
      },
      "is_downloadable": true,
      "content_hash": "c4aaf32c5eb77ec622cc44797a206cb5cd8cee02216cd98773f4deb5dddfc138"
    }
  ],
  "cursor": "AAGH_lfzMqN8k2xRWEYojPGQIrsbS-653JiMpm_NsFP-bxdQ6XD34Yl79XSWXtLt6Olds7I7ByFNlcqsSj3aXzr2aDmqCWiKy0D7-BALOObMMmHWwrKMKZ5No7E2bRnzTG9qF-t5dGRIaB4mr5aCyFg-aq5M2Zm08s5DRmBDPnoK_31ckeEoe-V6U1BCiuhGMEa664tTyJbJsJU_p3szks0i2iRdTPgS75TsEcXWpEuL9IosLEx9RIwss1aK5zVEnJKJOJhujgtMY_sQXh4SYkWM48-KKvgHO-d53XEV5Saxu7FgPj--AyJGPxMUGd764yA",
  "has_more": false
}

 

5) Try to download one of those files

https://dropbox.github.io/dropbox-api-v2-explorer/#files_download

paste any of those entries ids from above (ala id:zY8_f7IMoCgAAAAAAAIRnQ) 

 

{
  "error_summary": "path/not_found/...",
  "error": {
    ".tag": "path",
    "path": {
      ".tag": "not_found"
    }
  }
}

cc @Greg-DB 

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

When calling /2/sharing/get_shared_link_file, 'url' would be the shared link URL, and 'path' would be the relative path for the file you want. 

 

So, for your example above, you could use:

'url': 'https://www.dropbox.com/sh/1dj7xiu7s0kgqoo/AADQjza7GmZlOFZk9pk0KHVda?dl=0'

'path': '/Papa Smurf.pro'

View solution in original post

4 Replies 4

Greg-DB
Dropbox Staff
Go to solution

The /2/files/download endpoint only supports downloading files in the connected account, so this error is expected in this case.

 

For this use case, you'd instead need to use /2/sharing/get_shared_link_file (sharingGetSharedLinkFile).

 

Both of those only support "user authentication" though, so an access token is necessary. I'll pass this along as a feature request for support for calling without an access token, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though. 

 

Another option would be to download from the shared link itself using the "dl" parameter documented here, but that doesn't offer a way to specify an get only a particular file from the linked folder. 

 

Also, I should note that scraping the Dropbox web site is prohibited by the terms, and subject to break without warning anyway.

elsigh
Helpful | Level 5
Go to solution

But `sharingGetSharedLinkFile` requires an URL and all I have in those entries is an `id` (and some other fields, but not `url`) - is there any other way I should go about this? Gracias!

Greg-DB
Dropbox Staff
Go to solution

When calling /2/sharing/get_shared_link_file, 'url' would be the shared link URL, and 'path' would be the relative path for the file you want. 

 

So, for your example above, you could use:

'url': 'https://www.dropbox.com/sh/1dj7xiu7s0kgqoo/AADQjza7GmZlOFZk9pk0KHVda?dl=0'

'path': '/Papa Smurf.pro'

elsigh
Helpful | Level 5
Go to solution

Thank you so much, totally works!

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    elsigh Helpful | Level 5
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?