1

I'm new to working with APIs and I keep receiving a 'response 401' when trying to connect to the Redtail API.

Here is a bit of documentation on Redtail: https://help.redtailtechnology.com/hc/en-us/articles/203964430-Authentication-Methods-

And here is my code:

import requests
headers = {
'APIKey': '6C135EDF-C37C-4039-AEF3-5DFC079F9E6A',
'Username': 'Statementone',
'Password': 'sonedemo'
}
r = requests.get('https://api2.redtailtechnology.com/crm/v1/rest/', n 
headers=headers)
print(r)

Any help would be greatly appreciated!

Ethan Koch
  • 25
  • 5

1 Answers1

0

When supplying the credentials, you will want to use base64 encoding as well as specify the Basic authentication type.

Note: The demo credentials from the documentation seem to be no longer valid. Also the URL you were using will return a 404 as it is not a valid URL. Example below with URL will pull all contacts.

import requests
import base64

APIKey = '6C135EDF-C37C-4039-AEF3-5DFC079F9E6A'
Username = 'Statementone'
Password = 'sonedemo'

token = APIKey + ':' + Username + ':' + Password
b64Val = base64.b64encode(token)

headers = {'Authorization': 'Basic %s' % b64Val}

r = requests.get('https://api2.redtailtechnology.com/crm/v1/rest/contacts', headers=headers)
print(r)