Forum Discussion

Esteban S.2's avatar
Esteban S.2
New member | Level 1
11 years ago

Business API with Python SDK

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

Replies have been turned off for this discussion
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    11 years ago

    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.

  • 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's avatar
    Esteban S.2
    New member | Level 1
    11 years ago

    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'.

  • Esteban S.2's avatar
    Esteban S.2
    New member | Level 1
    11 years ago

    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?

  • 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's avatar
    Esteban S.2
    New member | Level 1
    11 years ago

    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.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

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, Facebook or Instagram.

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!