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

AlexBrajkovic's avatar
AlexBrajkovic
Explorer | Level 4
8 years ago

ListFolder limit?

What is the limit of retrieved items using listFolder?

When using listFolderContinue, what will be response? All data, including files/folders from previous call to listfolder) or just additional missing files/folders?

  • I don't see where there is an actual limit that you can set, it seems to be arbitrary. That said, basically when you make the initial post to list_folder that will return some number of entities along with a cursor value and a has_more value. Think of the cursor as a page value that already knows the user being queried and other information so all you have to post to list_folder/continue all you have to send it is the cursor value. That will return the next page of entities along with another cursor for the page after that, and so on until cursor is returned empty.  Not sure what language you are using but I'm doing it like this in PHP.

     

    $first_page = true;

    $api = $first_page ? 'https://api.dropboxapi.com/2/files/list_folder' : 'https://api.dropboxapi.com/2/files/list_folder/continue';

    do {

     

    if ($first_page) {

        $data = json_encode(array(
            "path" => "",
            "recursive" => true,
            "include_media_info" => false,
            "include_deleted" => true,
            "include_has_explicit_shared_members" => false,
        ));

        $first_page = false;

    } else {

         $data = json_encode(array(
            'cursor' => $cursor
        ));

    }

     

    ... Make the call out to the endpoint and get the response ($response);

     

    } while {$response->has_more);

     

    After the first call out $first_page is set to false so if $response->has_more returns 1 the cursor is sent page requesting the next page.  Once you hit the end $response->has_more will be empty.

     

    Hope that helps.

  • jwpegram's avatar
    jwpegram
    Helpful | Level 6

    I don't see where there is an actual limit that you can set, it seems to be arbitrary. That said, basically when you make the initial post to list_folder that will return some number of entities along with a cursor value and a has_more value. Think of the cursor as a page value that already knows the user being queried and other information so all you have to post to list_folder/continue all you have to send it is the cursor value. That will return the next page of entities along with another cursor for the page after that, and so on until cursor is returned empty.  Not sure what language you are using but I'm doing it like this in PHP.

     

    $first_page = true;

    $api = $first_page ? 'https://api.dropboxapi.com/2/files/list_folder' : 'https://api.dropboxapi.com/2/files/list_folder/continue';

    do {

     

    if ($first_page) {

        $data = json_encode(array(
            "path" => "",
            "recursive" => true,
            "include_media_info" => false,
            "include_deleted" => true,
            "include_has_explicit_shared_members" => false,
        ));

        $first_page = false;

    } else {

         $data = json_encode(array(
            'cursor' => $cursor
        ));

    }

     

    ... Make the call out to the endpoint and get the response ($response);

     

    } while {$response->has_more);

     

    After the first call out $first_page is set to false so if $response->has_more returns 1 the cursor is sent page requesting the next page.  Once you hit the end $response->has_more will be empty.

     

    Hope that helps.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff
    Thanks jwpegram! That's correct, the listFolderContinue response will be structured similarly to listFolder, and will only contain further/new entries, not the same entries already returned by listFolder.

    Also, each listFolder/Continue response generally won't be more than around 2,000 items, but that can vary, so don't rely on that number.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,912 PostsLatest Activity: 54 minutes ago
333 Following

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!