Announcements
Do you have an idea for Dropbox Paper? Share it with us here!

Getting 409 error when calling list_folder on empty folder

Explorer | Level 4

I have been consistently getting 409 errors on some empty team folders. I am using Dropbox-Select-API-Admin header and listing team folders recursively. I am using the path to list those folders, that is if my team folder name is 'team folder', I use '/team folder' as path. It works on folders that is not empty (works on some empty folders too), but there are a few folders where the call fails with 409 error.

Here's the full response including the response headers.

409 Client Error: Conflict for url: https://api.dropboxapi.com/2/files/list_folder: {"error_summary": "path/not_found/.", "error": {".tag": "path", "path": {".tag": "not_found"}}}: {'Server': 'nginx', 'Date': 'Sat, 02 Mar 2019 00:09:24 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Content-Security-Policy': "sandbox; frame-ancestors 'none'", 'X-Dropbox-Request-Id': 'acc37d6f010a3d47a878e8c7c370ceb0', 'X-Frame-Options': 'DENY', 'X-Content-Type-Options': 'nosniff', 'Content-Disposition': "attachment; filename='error'"}

 

If I use namespace_id to list the folders, then I don't get any errors and the empty folders list fine, but the problem with namespace call is that paths do not return in response. If I use the path root header, then paths are returned but they are relative (that is paths in response do not start with '/team folder/sub-folder' rather '/sub-folder'). The purpose the folder walk is to extract each folder/file path.

1 Accepted solution

Accepted Solutions

Re: Getting 409 error when calling list_folder on empty folder

Dropboxer

If you're signed in to the Dropbox web site as that user, for instance, you wouldn't see the "Product Management" team folder listed in the user's file listing on https://www.dropbox.com/home . You would see it listed on the team's admin console on https://www.dropbox.com/team/admin/team_folders/home though. You could then use the "Manage" button to add a group to it. Once a group is added, if the user is a member of that group, it would be mounted for that user and so listed on https://www.dropbox.com/home .

Likewise, via the API, you can add a group using the /2/sharing/add_folder_member endpoint, like this:

curl -X POST https://api.dropboxapi.com/2/sharing/add_folder_member \
    --header "Authorization: Bearer <ACCESS TOKEN>" \
    --header "Dropbox-API-Select-Admin: <ADMIN TEAM MEMBER ID>" \
    --header "Content-Type: application/json" \
    --data "{\"shared_folder_id\": \"<TEAM FOLDER ID>\",\"members\": [{\"member\": {\".tag\": \"dropbox_id\",\"dropbox_id\": \"<GROUP ID>\"}}]}"
Reply
Loading...
8 Replies

Re: Getting 409 error when calling list_folder on empty folder

Explorer | Level 4

And my other question is about include_mounted_folders param. How does it work? I know if I set it to false when listing team member's folders, then I am only going to get unshared folders (i.e. no app/team/shared folders), but how it does it behave when I set it to false when listing team folders? For example, a team folder may contain folders that have been shared so they appear as a shared folder in namespace. Now when I list the team folder with `include_mounted_folders` set as False, wouldn't I get the shared folders and their contents in response?

Reply
Loading...

Re: Getting 409 error when calling list_folder on empty folder

Dropboxer

Regarding the unexpected 409 errors, can you share the full request and response, including parameter values? I can't offer much insight about these errors without seeing the requests as well, since it seems to vary by folder. Be sure to redact the access token of course. Namespace IDs and paths are safe to include since they don't enable access to any data. Please open an API ticket if you'd prefer to share privately though.

Regarding your 'include_mounted_folders' question, if that parameter is set to False, the result will exclude "entries under mounted folders". By default, the contents of team folders, including any normal folders under the team folder, are not "mounted", so the contents of normal sub-folders would not be excluded. If the sub-folder of a team folder has been shared though, it is "mounted", and so the shared sub-folder's contents will be excluded.

Reply
Loading...
Highlighted

Re: Getting 409 error when calling list_folder on empty folder

Explorer | Level 4

Greg,

There is a team folder called 'Product Management', I make the following curl and get 409.

curl -X POST -H "Authorization: Bearer <access_token>" -H "Dropbox-API-Select-Admin: <team_member_id of a team admin>" --data '{"path": "/Product Management"}' https://api.dropbox.com/2/files/list_folder

Response:

{"error_summary": "path/not_found/.", "error": {".tag": "path", "path": {".tag": "not_found"}}}

 

I then make the same curl, but this time I use namespace_id as path and folder lists fine even though it's empty.

curl -X POST -H "Authorization: Bearer <access_token>" -H "Dropbox-API-Select-Admin: <team_member_id of a team admin>" --data '{"path": "ns:<namespace_id>"}' https://api.dropbox.com/2/files/list_folder

 

I have provided the response header of the failed request in my first post, it contains request-id which I believe you can use to check why the request failed.

 

 

Reply
Loading...

Re: Getting 409 error when calling list_folder on empty folder

Dropboxer

Thanks! That's helpful. The "Product Management" team folder can't be found at the path "/Product Management" because that team folder is not mounted in that account (and so does not have a path).

It can still be accessed by namespace ID since it does exist and is owned by the team though.

Reply
Loading...

Re: Getting 409 error when calling list_folder on empty folder

Explorer | Level 4

I don't understand what you mean by not mounted. I logged in to Dropbox Team as a team admin and created team folder, the folder is not shared with anyone. How do I mount a folder then?

Reply
Loading...

Re: Getting 409 error when calling list_folder on empty folder

Dropboxer

If you're signed in to the Dropbox web site as that user, for instance, you wouldn't see the "Product Management" team folder listed in the user's file listing on https://www.dropbox.com/home . You would see it listed on the team's admin console on https://www.dropbox.com/team/admin/team_folders/home though. You could then use the "Manage" button to add a group to it. Once a group is added, if the user is a member of that group, it would be mounted for that user and so listed on https://www.dropbox.com/home .

Likewise, via the API, you can add a group using the /2/sharing/add_folder_member endpoint, like this:

curl -X POST https://api.dropboxapi.com/2/sharing/add_folder_member \
    --header "Authorization: Bearer <ACCESS TOKEN>" \
    --header "Dropbox-API-Select-Admin: <ADMIN TEAM MEMBER ID>" \
    --header "Content-Type: application/json" \
    --data "{\"shared_folder_id\": \"<TEAM FOLDER ID>\",\"members\": [{\"member\": {\".tag\": \"dropbox_id\",\"dropbox_id\": \"<GROUP ID>\"}}]}"
Reply
Loading...

Re: Getting 409 error when calling list_folder on empty folder

Explorer | Level 4

Thanks for the explanation! However, if I am a team admin wouldn't that folder be mounted for me even if it is not shared with anyone?

Reply
Loading...

Re: Getting 409 error when calling list_folder on empty folder

Dropboxer

No, the folder isn't automatically mounted, even for the admin that creates it. (The web site does default to recommending the admin share it with the team right after creating it, so that's common, but it is optional.)

Reply
Loading...
API Support

Have a question? Our Dropbox Community is here to help you find an answer!
You won’t have to wait too long for a reply, but why not learn more about the Community while you’re here.

Not the right discussion for you? Find out what else our Community has to say about API Support.

Or, search our Help Center for even more.