You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
OLR_A
7 years agoNew member | Level 2
API V2 Access team folders of bussines plan with Folder/Files operations
i want to acces team folders using application user api for list,create folders, upload and download,etc.. and i'm going crazy. In API Explorer with function "list_folder", only can acces user ho...
- 7 years ago
It sounds like you're using a Business team with the new team space and member folders configuration that some teams have access to.
That being the case, you'll need to specify the team folder specifically when making API calls to access its contents, for example, by supplying the 'Dropbox-API-Path-Root' header. You can find more information on that here:
https://www.dropbox.com/developers/reference/namespace-guide
The Dropbox API Explorer is built for the older configuration, but we're working on updating the API and SDK support and documentation to support the new one. That's not quite ready yet though, so unfortunately there isn't a good way to use the API Explorer for this right now, but you can run it outside the of Explorer. Apologies for the inconvenience!
Greg-DB
Dropbox Staff
It sounds like you're using a Business team with the new team space and member folders configuration that some teams have access to.
That being the case, you'll need to specify the team folder specifically when making API calls to access its contents, for example, by supplying the 'Dropbox-API-Path-Root' header. You can find more information on that here:
https://www.dropbox.com/developers/reference/namespace-guide
The Dropbox API Explorer is built for the older configuration, but we're working on updating the API and SDK support and documentation to support the new one. That's not quite ready yet though, so unfortunately there isn't a good way to use the API Explorer for this right now, but you can run it outside the of Explorer. Apologies for the inconvenience!
tianhong
6 years agoNew member | Level 2
HI Greg,
I have the same problem of accessing team shared folder.
I tried to follow the namespace guide. I am using python. First get namespace ids:
"root_namespace_id": "4345996448", "home_namespace_id": "4770419568",
Then create dbx object with a header:
header = {'Dropbox-API-Path-Root': {".tag": "namespace_id", "namespace_id": "4345996448"}} dbx = dropbox.Dropbox(TOKEN, header)
But when do a
dbx.files_list_folder('')
still showing my user's home dir, not team shared one. If I add 'ns:4345996448' to PATH, it would fail.
Can you help me with it? Thanks.
- Greg-DB6 years agoDropbox Staff
tianhong To set the 'Dropbox-API-Path-Root' header, you should instead use the provided 'Dropbox.with_path_root' method, like this:
dbx = dropbox.Dropbox(TOKEN).with_path_root(dropbox.common.PathRoot.namespace_id("1990815600")) dbx.files_list_folder('')
- tianhong6 years agoNew member | Level 2
Thanks Greg! It works.
I am just wondering how to search these kinds of information in the documentation. I tried but failed. I don't think asking questions here is an efficient way, although your help is great.
- Greg-DB6 years agoDropbox Staff
tianhong Thanks for the feedback! The documentation for the Python SDK is linked from the SDK's readme, and all of the options for the `Dropbox` class can be found on this `Dropbox` documentation page in particular. I certainly understand how that may not be very discoverable though, so we'll think about ways to make that better.
- tomkr4 years agoNew member | Level 2
Hi Greg, when I use this with the shared folders namespace ID :
dbx = dropbox.Dropbox(token).with_path_root(dropbox.common.PathRoot.namespace_id("6951349920"))
dbx.files_list_folder('')I get the following error:
BadInputError('1cac57bc6ffa43f2ab66041af9f4dec7', 'Error in call to API function "files/list_folder": This API function operates on a single Dropbox account, but the OAuth 2 access token you provided is for an entire Dropbox Business team. Since your API app key has team member file access permissions, you can operate on a team member\'s Dropbox by providing the "Dropbox-API-Select-User" HTTP header or "select_user" URL parameter to specify the exact user <https://www.dropbox.com/developers/documentation/http/teams>.')
I do not see in the documentation how to set the "select_user" or "Dropbox-API-Select-User" parameters in the python API.
When getting the member ID, would you use something like:
```dbx = dropbox.DropboxTeam(token)
members = dbx.team_members_list()
member_id = members.members[0].profile.team_member_id```
?
- tomkr4 years agoNew member | Level 2
As a quick update, when I set the header with:
dbx_team = dropbox.DropboxTeam(token)
members = dbx_team.team_members_list()
member_id = members.members[0].profile.team_member_idheader = {"Dropbox-API-Select-User": member_id}
dbx = dropbox.Dropbox(token, header).with_path_root(dropbox.common.PathRoot.namespace_id("8378003952"))
I get the same error.
- steve_r3 years agoNew member | Level 2
Are there constants for the root_namespace_id and home_namespace_id? Seems unnecessary to have to call the
api to retrieve the namespace IDs. Can you use a constant for the these IDs given the current user? For example:dbx = dropbox.Dropbox(TOKEN).with_path_root(dropbox.common.PathRoot.namespace_id(".root"))
- Greg-DB3 years agoDropbox Staff
steve_r No, the Dropbox API doesn't offer a constant for the root like that, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though. Note that the root namespace ID can change though, so while you can cache the value so you don't have to look it up each time, be aware you can get an error if/when it does change, in which case you would look up the new one. Refer to the documentation for more information.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,911 PostsLatest Activity: 10 hours agoIf 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 or Facebook.
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!