Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Mario P.18
10 years agoNew member | Level 1
List folders at root (list_folder v2 API)
Is it possible to list the contents of the Dropbox root directory from the v2 APIs?
Calling the list_folder endpoint as follows yields an error:
curl -H 'authorization: Bearer ****' -H 'content-type: application/json' 'https://api.dropboxapi.com/2/files/list_folder' -d '{ "path": "/" }'
{"error_summary": "path/malformed_path/", "error": {".tag": "path", "path": {".tag": "malformed_path"}}}
4 Replies
Replies have been turned off for this discussion
- Greg-DB10 years ago
Dropbox Community Moderator
Hi Mario, you can certainly list the contents of the root. The root is identified by the empty string, ", and not a single slash, "/", though. So, you just need to call with this instead:
-d '{ "path": " }' - Mario P.1810 years agoNew member | Level 1
@Gregory
Unfortunately, I tried that earlier and received the following error which appears like a missed case in the validation regex:
Error in call to API function "sharing/create_shared_link_with_settings": request body: path: '' did not match pattern '((/|id:).*)|(rev:[0-9a-f]{9,})' - Greg-DB10 years ago
Dropbox Community Moderator
Based on that error, you got that from the /sharing/create_shared_link_with_settings endpoint. That's expected for that endpoint, as you can't create a shared link for the root. Your original question was about /files/list_folder, where the empty string should work to represent root.
- Mario P.1810 years agoNew member | Level 1
Indeed you are correct - I must not have tested the empty-space against the list_folder command before posting.
It was, however, my intention to try and create a share at the root of my Dropbox. Looking through the user interface, however, it doesn't appear like this is a valid operation.
Thanks for taking the time and following up.
Cheers
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
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!