Building Your First API Call

Now that you've set up your staging account access, you're ready to make your first call to the stage API!

Our example code is in Python because it's easy to understand and commonly used, but you can use any language that can make Web calls. If you haven't set up a Python environment, download Python and configure it to your liking.

The Python examples require the requests and requests_toolbelt modules, so install the modules from the command line with:

python -m pip install requests
python -m pip install requests_toolbelt

The following Python code will make the GET call to the /credit endpoint to pull the awesomeuser user's credit balance.

import requests

url = ""

# Define credentials
myusername = 'awesomeuser'
mypassword = 'gReAt/PaSsWoRd123

headers = {"Accept": "application/xml"}

response = requests.get(url, headers=headers, auth=(myusername, mypassword))


Run the file:


and if you did it right, you should get the following XML back:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

Note that your XML will not contain the line breaks

Congratulations! You have taken your first step into a larger world!

For a line-by-line explanation of the above code, see our recipe: