cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We love to hear how every person gets the most from Dropbox, and it seems everyone has a slightly different use for it - tell us yours here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Query Dropbox API

Query Dropbox API

JessicaPaul
New member | Level 2

Hello.
I am trying to query Dropbox using python's from dropbox import DropboxTeam request_json_object API.
I need to  query the API path: files/list_folder
My request look like

 

 

 

 

request_json_object(dict(
    host='api',
    auth_type='team',
    route_style='rpc',
    request_binary=None,
    route_name='files/list_folder',
    request_arg={'limit': 1, 'select_user': 'userid:111...111'}
))

 

 

 

 



But I am getting this error BadInputError

'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 



1 Reply 1

Re: Query Dropbox API

Greg-DB
Dropboxer

First, note that you don't need to use the request_json_object method directly. You should use the provided native methods for the API endpoints, such as files_list_folder for /2/files/list_folder.

 

Anyway, this error message is referring to specifying what account on the Business team to operate on behalf of. When using any "team scopes", the resulting access token is connected to an entire Dropbox Business team, not an individual account. So, when using a team-scoped access token to access user-specific endpoints, such as /2/files/list_folder via the files_list_folder method in the Python SDK, 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. The value should be the team_member_id for whichever member you wish to act on behalf of. In the Python SDK, that can be done using the DropboxTeam.as_user method.


Alternatively, if you just want to connect to your particular account, you can disable any team scopes and get a new access token without them. The access token without the team scopes will be specific to the particular account (Business or not) and so will not require the additional header. You can find more information on scopes in the OAuth Guide. If you don't need to call any team endpoints (e.g., if you just need to call file endpoints, such as /2/files/list_folder via the files_list_folder method), you may prefer to use this solution instead for simplicity and security.

Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?