Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

schmidtc63's avatar
schmidtc63
New member | Level 2
5 months ago

Retrieve folders recursively

I'm using 2/files/list_folder and 2/files/list_folder/continue.

However, there are a couple hundred thousand files here which makes it nearly impossible to get a simple folder structure. Having to parse a huge JSON response looking for .tag="folder", especially over multiple cursors, is untenable.

Is there a way to add a filter to this request to retrieve only ".tag": "folder" entries? 

Thanks,

Chris

8 Replies

  • schmidtc63's avatar
    schmidtc63
    New member | Level 2
    5 months ago

    I even tried this:

    curl -X POST https://api.dropboxapi.com/2/files/search_v2 \
      --header 'Authorization: Bearer <MYTOKEN>' \
      --header 'Content-Type: application/json' \
      --header 'Dropbox-Api-Select-User: dbmid:AACFxh5TjXXXXXXXXXX' \
      --data '{"query":"","options":{"path":"/kickee images","file_extensions":[],"file_categories":[{".tag":"folder"}]}}'

    It has been running for 2 hours now.

     

  • DB-Des's avatar
    DB-Des
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    5 months ago

    Hi schmidtc63​ 

    In order for us to further look into this issue for you, please provide us with 5-10 different 'X-Dropbox-Request-Id' response header values.

  • schmidtc63's avatar
    schmidtc63
    New member | Level 2
    5 months ago

    82ec54c5c3b743908fefe5f173c7f733
    db4ae57b2363494691c87d39a4e45eb6
    9092796f78e84dd98dfcc0aba5804681
    b42a5895caaf49a4b43bb6ded61c5f04
    4972555c763f477daf1924461caf4917
    14df185844cf42d3974161bb7312fc40
    42c0e1e7f15a45bc86899670e212662f
    2ab204b09fa946749d1d196ed4db96b5
    88a2d426a9d746a1ae86f3970ae6eed2
    2043063e6016487184d84c7e133330c3
    ba9cfe7941324e21a40452b4c03de7c2
    086ea9a155c84a5db66e5411d741dbc7
    254f6e94120642a79f81f94c49a37f3a
    5efd5192c3464011b939e5945f907c5a
    40872e1887d443a49f080d991d639f7b
    eda6a0fa2c2d4a9b9f1560fe675b0b81
    05931c9a34044f3aa9f9421c374eb168
    3305131cd167471fb97a08cd1438af5e
    6d1ece04b2964b2ab01dc6d41c08a8bd

  • DB-Des's avatar
    DB-Des
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    5 months ago

    schmidtc63​ 

    Thank you for that information.

    After taking a closer look at your request to the /2/files/search_v2 endpoint, it appears that the the reason it’s not working as expected is that the 'query' parameter is missing from your request.

    For the /2/files/search_v2 endpoint, the 'query' parameter is not optional. If you add a value to this parameter and try again, you should get a response.

  • schmidtc63's avatar
    schmidtc63
    New member | Level 2
    5 months ago

    Ok. Maybe generate an error if the query is required? However, I was simply trying to get all entries with a "file_categories":[{".tag":"folder"}], regardless of the name of the file. Is there no  way to do a wildcard search?

  • DB-Des's avatar
    DB-Des
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    5 months ago

    schmidtc63​ 

    The ability to do a wildcard search isn't currently available on the Dropbox API, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from 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!