We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.
Forum Discussion
psehrawat
8 years agoNew member | Level 2
How to download files from a publicly shared folder?
We developed an app using an endpoint from v1 /1/metadat/link (to list all from a shared link). I couldn't find any endpoint from v2 having same functionality. My app has a simple a functionality...
Greg-DB
Dropbox Staff
RTS S. Both /2/files/list_folder and /2/files/download support both file IDs and paths. (You can check the supported formats in the documentation for the 'path' value.)
So, for instance when calling /2/files/list_folder, you can supply the 'path' parameter containing either the 'id' of the folder you want to list, or the full path to the folder.
Likewise, when calling /2/files/download you can supply the 'path' parameter containing either the 'id' of the file you want to download, or the full path to the file.
RTS S.
7 years agoHelpful | Level 6
I use the same code to Navigate (files/list_folder) and download (files/download) for both my APP/User token and for a shared folder using a User token. I am able to download a file using an id:xxxx for the path using my APP/User token. But having problems with the shared folder: The following is for a Test File in a Test Account. URL: POST: https://api.dropboxapi.com/2/files/list_folder post args: { "path": "", "shared_link": { "url": "https://www.dropbox.com/sh/tva3ktdtul2qkth/AACU1dkvaBr31u6sIiDstKACa"}, "include_media_info": false, "include_deleted": false} Result: { "entries": [ {".tag": "file", "name": "2-11011_in__flight.jpg.sdvef", "parent_shared_folder_id": "3372935536", "id": "id:sQqvvpADHyAAAAAAAAAAIA", "client_modified": "2018-06-21T13:49:31Z", "server_modified": "2018-06-21T13:49:32Z", "rev": "12c90ae970", "size": 99110, "sharing_info": {"read_only": true, "parent_shared_folder_id": "3372935536", "modified_by": "dbid:AACm4Dw3RG5ecK3uwT2z3MVi2GWwuS6rYBg"}, "content_hash": "442d907dc20fffe801d271a6512e5c58906adb157329e5e9356b91e323a9d2bb"} ], "cursor": "AAH96nNWXINQZ4eyuP2VShr5_NM-LfHyN_XSlyR98jhdwct-3t3fIncgCM7X9Eh_-LRQk4jP-IMK52-wQSQKFXCGyseUo3xm8Izh8_9GI_9_EVbB1RYrEiGV9BLNX3znJKUhxnsB8_Q_euGZBBe_X34_0f85NXG595ciaEmzWj7HtXhfLEFQPhlCqu05XoRSQUs8NNkHU3up60VaD6-Zp6Fsn2iem9h9gLuQIWpc8C9O-meRNmAyafZW9FvTT2zAi8r6xkUg-BUJkLUYYVTNmTM_", "has_more": false } URL: GET https://content.dropboxapi.com/2/files/download Headers: Dropbox-API-Arg {"path":"id:sQqvvpADHyAAAAAAAAAAIA"} Range bytes=0-99109 Result: ERROR: Content: {"error_summary": "path/not_found/.", "error": {".tag": "path", "path": {".tag": "not_found"}}} Headers: { Content-Security-Policy: sandbox, sandbox allow-forms allow-scripts Connection: keep-alive Server: nginx X-WebKit-CSP: sandbox Transfer-Encoding: chunked Date: Tue, 26 Jun 2018 23:35:18 GMT X-Content-Security-Policy: sandbox Vary: Dropbox-API-Arg, Authorization X-Robots-Tag: noindex, nofollow, noimageindex X-Content-Type-Options: nosniff X-Dropbox-Request-Id: 8e068903125489c79e7132583f05b8d7 }
Do I need to do something different for downloaing a file from a shared URL ? I provided the public link .... but it's a test account with a test folder with a single file. I provided it so you might try accessing the file ...
- Greg-DB7 years agoDropbox Staff
RTS S. I see, thanks for clarifying and providing the sample. In this case, based on this error, it sounds like you have a shared link from a different user than the one that the access token is for. That being the case, you can't directly access the file via ID, since it isn't in the authorized user's account.
Instead, after listing the contents, to download a file from the folder that the shared link points to, you should use /2/sharing/get_shared_link_file (instead of /2/files/download). That allows you to download files based on the shared link itself.
- RTS S.7 years agoHelpful | Level 6
Thank you ... I have everything I need.
As I indicated it would still be a nice feature to be able to access to a publicly shared folder/file without the need to authenticate any user.
If I have the shared URL as an end user I can use a browser to navigate the folder and download a publicly shared folder ... I do not need to authenticate with any dropbox account.
I should be able to do the same with maybe an APP TOKEN (not a login to the dropbox app) to provide some traceability. Then providing the URL I should be able to navigate and download the publicly shared files and folders.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,875 PostsLatest Activity: 3 hours agoIf 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 or Facebook.
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!