cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Find out how Tiffany, a Customer Experience superstar uses Dropbox to keep her family in the loop when it comes to her new baby 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: 

Re: Download shared folders via /2/files/download call

Download shared folders via /2/files/download call

time4116
Explorer | Level 4

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.

1 Accepted Solution

Accepted Solutions

Re: Download shared folders via /2/files/download call

Greg-DB
Dropboxer

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.

View solution in original post

2 Replies 2

Re: Download shared folders via /2/files/download call

Greg-DB
Dropboxer

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.

View solution in original post

Re: Download shared folders via /2/files/download call

time4116
Explorer | 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
}
Need more support?