Username and Password

You can also authenticate when making requests to Middesk's API endpoints using the username and password you use to log into your Middesk account. This method uses HTTP basic authentication.

import requests
from requests.auth import HTTPBasicAuth

basic = HTTPBasicAuth('_your_username_here_','_your_password_here_')
url = 'https://api.middesk.com/v1/businesses'
res = requests.get(url, auth = basic)

if res.ok:
	print(res.json())
else:
  print(res.content)

Please note that using basic auth with your username and password currently only works in Middesk's production environment. In the sandbox you will need to perform basic auth using your Test API Key. For more details on how to do that please see this article.