The Community is undergoing an upgrade and some features may be unavailable. Find out more here.
Forum Discussion
time4116
7 years agoExplorer | Level 4
Download shared folders via /2/files/download call
I've been calling /2/files/list_folder and then calling /2/files/download to download all files of a specific user. However, I noticed that I'm not able to download the content of the following types:
Team Folders
Shared Folders
I'm not worried about the team folders but I would like the ability to download all content within the shared folders (Most of these folders are shared between users and do not have a link created, for what it's worth). I've got the recursive param set to "true" and I see regular folders displaying child files but nothing appears for the shared folders other than the folder itself. I'm using the DropBox Buisness API (Team member file access) for authentication. Any help is greatly appreciated.
The /2/files/list_folder[/continue] interface is paginated, and you're not guaranteed to get all of the results on the first page. You need to check the `has_more` value in the response, and call back to /2/files/list_folder/continue, if it's true. Keep calling back to retrieve all of the pages until `has_more` is false in order to get all of the entries. You can find more information in the /2/files/list_folder documentation.
- Greg-DBDropbox Staff
The /2/files/list_folder[/continue] interface is paginated, and you're not guaranteed to get all of the results on the first page. You need to check the `has_more` value in the response, and call back to /2/files/list_folder/continue, if it's true. Keep calling back to retrieve all of the pages until `has_more` is false in order to get all of the entries. You can find more information in the /2/files/list_folder documentation.
- time4116Explorer | Level 4
Hmmm, I kept getting errors when I was trying to paiginate via PowerShell but didn't have any issues when I used requests via Python. Well, thanks for all your help Greg, really appreciate it!
Here's the PowerShell code I was using:
$arg = '{"path": "","recursive": true,"include_media_info": false,"include_deleted": false,"include_has_explicit_shared_members": false,"include_mounted_folders": true}' $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" $headers.Add("Authorization", $token) $headers.Add("Dropbox-API-Select-User", $dbmid) $Folders = Invoke-RestMethod -Uri https://api.dropboxapi.com/2/files/list_folder -Method Post -Headers $headers -ContentType "application/json; charset=utf-8" -body $arg $allFiles = $folders.entries.path_display while ($folders.has_more -eq "True") { $json = '{"cursor": "' + $folders.cursor + '"}' $json $folders = Invoke-RestMethod -Uri https://api.dropbox.com/2/files/list_folder/continue -Body $json -ContentType "application/json; charset=utf-8" ` -Headers @{ Authorization = $token } -Method Post $allFiles += $folders.entries.path_display }
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,874 PostsLatest Activity: 8 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!