Want to know more about Dash? Check out how Amy uses Dropbox and Dash to make her day easier here! 

Forum Discussion

time4116's avatar
time4116
Explorer | Level 4
8 years ago
Solved

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.

2 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    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.

  • time4116's avatar
    time4116
    Explorer | Level 4
    8 years ago

    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

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,017 PostsLatest Activity: 2 days ago
401 Following

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 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!