We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
time4116
8 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...
- 8 years ago
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-DB
Dropbox Community Moderator
8 years agoThe /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.
time4116
8 years agoExplorer | 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.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If 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, Facebook or Instagram.
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!