Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
rk90
7 years agoHelpful | Level 5
How do I get all files and folders on Dropbox Business account
I have asked this question in the past and did get answers but I am still struggling to figure this out. Basically, I want to export the entire structure of the given Dropbox Business account to a l...
Greg-DB
Dropbox Community Moderator
7 years agothere are several folders that are inside team folders and show up within the team folder on the UI, but when I list those folders via API I don't see `path_display`
Do you mean you're calling for a namespace directly as an admin without a root like this?
curl -X POST https://api.dropboxapi.com/2/files/list_folder \
--header "Authorization: Bearer <ACCESS_TOKEN>" \
--header "Dropbox-API-Select-Admin: <ADMIN_USER_ID>" \
--header "Content-Type: application/json" \
--data "{\"path\": \"ns:1990893360\"}"
# {
# "entries": [
# {
# ".tag": "folder",
# "name": "test",
# "parent_shared_folder_id": "1990893360",
# "id": "id:hro-cp_zmJAAAAAAAAAACg",
# "sharing_info": {
# "read_only": false,
# "parent_shared_folder_id": "1990893360",
# "traverse_only": false,
# "no_access": false
# }
# },
# {
# ".tag": "folder",
# "name": "test folder in team folder",
# "parent_shared_folder_id": "1990893360",
# "id": "id:hro-cp_zmJAAAAAAAAAADw",
# "shared_folder_id": "3980274560",
# "sharing_info": {
# "read_only": false,
# "parent_shared_folder_id": "1990893360",
# "shared_folder_id": "3980274560",
# "traverse_only": false,
# "no_access": false
# }
# }
# ],
# "cursor": "...",
# "has_more": false
# }
The paths aren't returned because this call isn't rooted anywhere; i.e., there's no root for the paths to be mounted relative to.
Instead, you can supply the path root using the 'Dropbox-API-Path-Root' header (from the Namespace Guide), like this:
curl -X POST https://api.dropboxapi.com/2/files/list_folder \
--header "Authorization: Bearer <ACCESS_TOKEN>" \
--header "Dropbox-API-Select-Admin: <ADMIN_USER_ID>" \
--header 'Dropbox-API-Path-Root: {".tag": "root", "root": "1990815600"}' \
--header "Content-Type: application/json" \
--data "{\"path\": \"ns:1990893360\"}"
# {
# "entries": [
# {
# ".tag": "folder",
# "name": "test",
# "path_lower": "/team folder 1/test",
# "path_display": "/team folder 1/test",
# "parent_shared_folder_id": "1990893360",
# "id": "id:hro-cp_zmJAAAAAAAAAACg",
# "sharing_info": {
# "read_only": false,
# "parent_shared_folder_id": "1990893360",
# "traverse_only": false,
# "no_access": false
# }
# },
# {
# ".tag": "folder",
# "name": "test folder in team folder",
# "path_lower": "/team folder 1/test folder in team folder",
# "path_display": "/team folder 1/test folder in team folder",
# "parent_shared_folder_id": "1990893360",
# "id": "id:hro-cp_zmJAAAAAAAAAADw",
# "shared_folder_id": "3980274560",
# "sharing_info": {
# "read_only": false,
# "parent_shared_folder_id": "1990893360",
# "shared_folder_id": "3980274560",
# "traverse_only": false,
# "no_access": false
# }
# }
# ],
# "cursor": "...",
# "has_more": false
# }
rk90
7 years agoHelpful | Level 5
Yes, I am not supplying the 'with root path' header. What about the deleted files/folders? There are several that don't return the path_display.
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!