Forum Discussion

Indoswift's avatar
Indoswift
Explorer | Level 3
4 years ago

Not able to fetch the root folders

Hi,

 

I am using Dropbox HTTP API's to list and create folders to my dropbox account. I created an app in developer console and given all the permission to generated key but still when I am using list_folder API, Its showing one folder only which is inside a folder of root directory and when I m trying to create a folder on root its creating folder inside another folder. How can I get all the folder and files which are on my root. I tried all possibility but no success. Please help.

2 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    4 years ago

    To list the contents of a folder, you should use the /2/files/list_folder and /2/files/list_folder/continue endpoints. For the root folder, you should set the "path" parameter to the empty string "". Note that you're not guaranteed to get all of the results back in a single response, so be sure to implement both of those endpoints. Refer to the documentation for information on how to do so properly.

     

    By the way, those are links to the documentation for the HTTPS endpoints themselves, but we recommend using one of the official SDKs if possible. Those have corresponding native methods for the HTTPS endpoints.

     

    Also, note that by default, API calls operate in the "member folder" of the connected account, so anything outside the member folder, such as in the "team space", if any, will not be found by default. You can configure API calls to operate in the "team space" instead though. To do so, you'll need to set the "Dropbox-Api-Path-Root" header. You can find information on this in the Team Files Guide. The File Access Guide may also be helpful.

  • Indoswift's avatar
    Indoswift
    Explorer | Level 3
    4 years ago

    Hi,

     

    Thank you so much for your support, I just added the Dropbox-Api-Path-Root with namespace id to the API call and things start working perfectly.

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API
Make connections with 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!