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

MarshallDavis's avatar
MarshallDavis
New member | Level 2
10 months ago

Entries Count Differs from Requested Limit

I'm using the /list_folder endpoint using the Dropbox-API-Path-Root header to display content from a team with shared dropbox. When I use the limit parameter with a value of 20 this returns 16 entries. However, if I then make an otherwise identical request with a limit parameter of 500 I would receive 40 entries.

 

These numbers are consistent. It always returns 16 rather than 20. It always returns 40 when requesting 500.

The documentation the limit parameter does state that it is an approximation and that sometimes more may be returned.

 

If I know that more than 20 entries exists (because a higher limit does produce more than 20) how do I determine why a limit of 20 would only return 16?

 

  • The page size returned by /2/files/list_folder or /2/files/list_folder/continue is not guaranteed, and the 'limit' parameter is the "maximum number of results to return per request". As that is only intended as a maximum, the server will attempt to not return more than that per page, but it is not guaranteed to return exactly that amount per page. Additionally, as you noted, in some cases it may even return slightly more than that amount per page.

     

    Regardless of the number of returned entries on any given page and also regardless of the specified 'limit' value, the app should always check the returned 'has_more' value to determine if it should call back to /2/files/list_folder/continue to get more results. Please refer to the documentation linked above for information on using that.

    • MarshallDavis's avatar
      MarshallDavis
      New member | Level 2

      While factual, and as evidenced by my observations, this doesn't help me understand why I might expect 16. Are some removed from the results after the page is selected? Is there something I can do to help fit specific files into pages?

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        The actual number of entries returned per page depends on a few implementation details of how Dropbox works, but I don't have more specific details to share on how that works.

         

        Apps shouldn't rely on a specific number of entries being returned per page though; apps should process any/all entries returned on a given page, and then check 'has_more' to determine if it should call back to /2/files/list_folder/continue, processing all entries on all returned pages until 'has_more' is false.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,888 PostsLatest Activity: 17 hours ago
326 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!