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
VoroMotors
2 years agoExplorer | Level 3
Trouble Accessing Teams Files via Python SDK
I'm creating a third party webapp to allow for us to quickly search and sort through categorized and tagged files that could be in any folder on dropbox. The process would be that the user inputs eit...
- 2 years ago
VoroMotors Здравко is correct; by default, API calls operate in the "member folder" of the connected account, not the "team space", so anything not in the member folder won't be found by default. You can configure API calls to operate in the "team space" instead though. To do so, you'll need to set the "Dropbox-API-Path-Root" header. You can find information on this in the Team Files Guide that you mentioned. With the Dropbox Python SDK, the with_path_root method sets that "Dropbox-API-Path-Root" header.
And regarding the "This API function operates on a single Dropbox account" error, it's worth mentioning that this error message is referring to specifying what account on the team to operate on behalf of. For reference, when using any "team scopes", the resulting access token is connected to an entire Dropbox team, not an individual account. So, when using a team-scoped access token to access user-specific endpoints, such as /2/files/get_metadata, you will need to specify which member of the team you want to operate on behalf of.
To do this, you'd need to specify the 'Dropbox-API-Select-User' header (or 'Dropbox-API-Select-Admin' as needed/desired). The value should be the team_member_id for whichever member you wish to act on behalf of. In the Dropbox Python SDK, that's as_user (or as_admin) as you mentioned.
Also, note that using any team scopes means that only team admins can authorize the app. If you just want to connect to a particular account though (in which case any account can connect the app, but to their own account only), you can omit the team scopes . The access token without the team scopes will be specific to the particular account (whether on a team or not) and so will not require the additional header. You can find more information on scopes in the OAuth Guide.
Здравко
2 years agoLegendary | Level 20
Hi VoroMotors,
As seems you have fixed your issue related to the posted error message. As you have found out you have to specify the user context behind which the action gonna proceed. All goes good till here.
Just to clarify: by default all user API calls (either direct API calls or performed through SDK) work on user folder as root. I.e. all paths specified are relative to the user folder (as you have found too). Here while for individual account the user folder coincide with account root, it's NOT the case for team account (like the one you're using). To be able reach to something outside user folder, you have to "reroot" your access (i.e. specify account root or some other namespace). Pointing another namespace, all path since then will be relative to that point. You don't need perform HTTP calls (if you don't want to), that's what SDKs are for. Particular in Dropbox Python SDK you can use with_path_root method to set new root. 😉
Hope this helps.
Add: In most of the cases (including when receiving metadata) wherever you use path, you can replace that path to id. Using URL directly is a bit more complicated (and restricted to some calls only), but still possible if you know what you're doing.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,882 PostsLatest Activity: 3 years 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!