Skip to content

Instantly share code, notes, and snippets.

@seanrose
Created May 30, 2012 00:55
Show Gist options
  • Save seanrose/2831909 to your computer and use it in GitHub Desktop.
Save seanrose/2831909 to your computer and use it in GitHub Desktop.
Making Your First Box API Call (Python)
import requests
#Set our API Key and the user's auth token (see http://developers.box.com/get-started/#authenticating)
api_key = YOUR_API_KEY
auth_token = YOUR_AUTH_TOKEN
auth_header = {'Authorization':
'BoxAuth api_key=%s&auth_token=%s' % (api_key, auth_token)}
#We're going to pull the contents of our account's root folder whose ID is '0'
api_url = 'https://api.box.com/2.0/'
resource = 'folders/0'
r = requests.get(url=api_url+resource, headers=auth_header)
print r.text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment