You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
denne
8 years agoExplorer | Level 3
General URL for many files from 1 shared folder
Hello community, In my dropbox I have a folder with 200 country flags which I would like to download automatically using the respective URLs. My problem is that the URL of every single file contain...
- 8 years agoDropbox API v2 now supports listing the contents of a shared link for a folder. This can be accomplished using the same interface as listing a folder in a connected user's account, via the list_folder functionality. To list the contents of a shared link for a folder, you instead provide the shared link URL in the `shared_link` parameter to list_folder:
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
You can also get the shared link metadata and file data using:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_metadata
https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_file
If you're using an official SDK, there will also be corresponding methods for these endpoints.
So, you could use a shared link for a folder and then programmatically list and access the contents.
Greg-DB
Dropbox Staff
Hi Denne, Sanchez is correct, there isn't a way to get a general shared link like this, but I'll pass this along as a feature request.
Greg-DB
8 years agoDropbox Staff
Dropbox API v2 now supports listing the contents of a shared link for a folder. This can be accomplished using the same interface as listing a folder in a connected user's account, via the list_folder functionality. To list the contents of a shared link for a folder, you instead provide the shared link URL in the `shared_link` parameter to list_folder:
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
You can also get the shared link metadata and file data using:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_metadata
https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_file
If you're using an official SDK, there will also be corresponding methods for these endpoints.
So, you could use a shared link for a folder and then programmatically list and access the contents.
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
You can also get the shared link metadata and file data using:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_metadata
https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_file
If you're using an official SDK, there will also be corresponding methods for these endpoints.
So, you could use a shared link for a folder and then programmatically list and access the contents.
- denne8 years agoExplorer | Level 3
Thank you Greg! I'll give it a try
- duckladydinh5 years agoExplorer | Level 4
I confirmed that this method is not going to work. The json response contains entries with id, tag and so one, but you cannot really download the subfolders or anything with them.
- Greg-DB5 years agoDropbox Staff
duckladydinh I'm not sure I understand your comment. If something isn't working as documented, please share the details so we can look into it for you.
For example, you can use the /2/files/list_folder endpoint to list the contents of a folder from a shared link for the folder:
curl -X POST https://api.dropboxapi.com/2/files/list_folder \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --header "Content-Type: application/json" \ --data "{\"path\": \"\",\"shared_link\": {\"url\": \"<SHARED_LINK_FOR_FOLDER>\"}}" # { # "entries": [ # { # ".tag": "folder", # "name": "Test", # "path_lower": "/test shared folder/test", # "path_display": "/test shared folder/Test", # "parent_shared_folder_id": "248930168", # "id": "id:uKXaztDfaPQAAAAAAAAABA", # "sharing_info": { # "read_only": false, # "parent_shared_folder_id": "248930168", # "traverse_only": false, # "no_access": false # } # }, # <redacted for brevity> # ], # "cursor": "<redacted for brevity>", # "has_more": false # }
And you can also list sub-folders like that using the "path" parameter:
curl -X POST https://api.dropboxapi.com/2/files/list_folder \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --header "Content-Type: application/json" \ --data "{\"path\": \"/test\",\"shared_link\": {\"url\": \"<SHARED_LINK_FOR_FOLDER>\"}}" # { # "entries": [ # <redacted for brevity> # { # ".tag": "file", # "name": "test.txt", # "path_lower": "/test shared folder/test/test.txt", # "path_display": "/test shared folder/Test/test.txt", # "parent_shared_folder_id": "248930168", # "id": "id:uKXaztDfaPQAAAAAAAAB3w", # "client_modified": "2018-05-10T17:07:46Z", # "server_modified": "2019-10-18T20:35:37Z", # "rev": "5953546d8c26e0ed65f78", # "size": 4, # "sharing_info": { # "read_only": false, # "parent_shared_folder_id": "248930168", # "modified_by": "<redacted for brevity>" # }, # "is_downloadable": true, # "content_hash": "954d5a49fd70d9b8bcdb35d252267829957f7ef7fa6c74f88419bdc5e82209f4" # } # ], # "cursor": "<redacted for brevity>", # "has_more": false # }
And then you can download a listed file using /2/sharing/get_shared_link_file by likewise using the relative path:
curl -X POST https://content.dropboxapi.com/2/sharing/get_shared_link_file \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --header "Dropbox-API-Arg: {\"url\": \"<SHARED_LINK_FOR_FOLDER>\",\"path\": \"/test.txt\"}" # test file contents
- duckladydinh5 years agoExplorer | Level 4
Hi, thank you Grek. K for your very helpful comment. I did not look at the 'get_shared_link_file' and yes, it can fix my current problem. I am sorry for jumping to an early conclusion reconfirmed that the solution works.
Just a little question: Is there any way to do the same for 'folder'?
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 3 days 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!