We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.

Forum Discussion

VoroMotors's avatar
VoroMotors
Explorer | Level 3
2 years ago

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...
  • Greg-DB's avatar
    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.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,875 PostsLatest Activity: 2 months ago
325 Following

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 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!