cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right 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: 

Business API with Python SDK

Business API with Python SDK

Esteban S.2
New member | Level 1

The current Python SDK does not appear to support the Business API; are there any good resources for app integration with the Dropbox for Business API?

7 Replies 7

Greg-DB
Dropbox Staff

That's correct, the Python SDK isn't built for the Dropbox for Business API (only the Core API), but I'll be sure to pass this along as feedback. Right now, the Dropbox for Business API is just meant to be consumed using an HTTP client, but the Python SDK is open source, so you can modify it if/as desired.

Steve M.
Dropbox Staff

Here's a little sample to help you get going. This code reads all the events for the team via the event log. (It uses the Python requests library.)

params = {}
while True:
    response = requests.post('https://api.dropbox.com/1/team/log/get_events', headers={
        'Authorization': 'Bearer %s' % access_token,
        'Content-Type': 'application/json'
    }, data=json.dumps(params)).json()

    for event in response['events']:
        print event # (or do something more useful)

    params['cursor'] = response['cursor']

    if not response['has_more']:
        print 'Sleeping...'
        time.sleep(10)

Esteban S.2
New member | Level 1

Thanks for the code snippet.

To clarify, is the access token here the same as the access token generated either on the app console or through passing in the app key/app secret to the dropbox client, then authorizing the given url? I have not been been able to make any specific dropbox for business API calls using that token (the token works perfectly for Core API calls); for example, the request below returns a 403 'App does not have access to this endpoint'. The app is set to have 'team member file access'.

Steve M.
Dropbox Staff

Yes, it's the access token you got from the app console or by authorizing an actual user (a Dropbox for Business team admin, in this case).

To access this endpoint, though, you do need "team auditing" permission. See https://www.dropbox.com/developers/business/docs#log-get-events.

Esteban S.2
New member | Level 1

Thanks, Steve. It looked to me like team auditing permission was bundled with file access; the description next to that permission level reads: "Team information and auditing, plus the ability to perform any action as any team member". Is there some other step needed to get access to the right permissions to access the business api endpoints?

Steve M.
Dropbox Staff

Oh, sorry! You're right.

My only guess is that you're not using an access token from the right app? Double check that the app permission is what you think it is and that you generated a token for the right app.

Esteban S.2
New member | Level 1

Thanks so much for your help, Steve! I'm not sure what the problem was, I deleted the app & reset it up and everything seems to be working fine. Must've done something odd when setting up the app the first time around. Thanks again for your help troubleshooting.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Esteban S.2 New member | Level 1
  • User avatar
    Steve M. Dropbox Staff
What do Dropbox user levels mean?