This article will show you how to authenticate to a custom REST API using headers.
This is a common authentication method, but every program does it differently. Zapier says the following: “API keys were conceived at multiple companies in the early days of the web. As a result, API key authentication is a bit like the wild west; everybody has their own way of doing it.” So the authorization method we’re going to describe may work for the integration you’re trying to connect to, and it might not.
To connect to your REST API, log in to your Grow account and select Custom REST API from the list of data sources.
You’ll first need enter in an API URL. (If you need more information on these, you can check out our help article here.) We’ll use a URL from the example on that article.
In the Key field, enter the word
Accept. This tells the system what format data needs to come back in. So in the Value field, enter
Afterwards, press the plus button underneath the Value field. This will add another header that we can use for the authorization.
The second field will let you authenticate to the system with your API key. The only problem is that JSON doesn’t let you just enter your API key, so we need to encode it to base64 first.
The actual process involves combining the username with a colon, followed by the password, and then running the whole string through the base64 encoding algorithm.
First, you’ll want to have your API Key handy. Go to base64encode.org (or another website like it) and type in
user:yourapikey, filling in “yourapikey” with your actual API key.
After you encode it, you will see an encoded value appear. Copy this value.
In Grow, put
Authorization into the Key field. In the
Value field, enter
Basic your-encoded-api-key, filling in “your-encoded-api-key” with your actual base64-encoded API key. Be sure to note that there is a space between
Basic and your encoded API key.
This will take care of the authentication to your REST API.
Press Connect, and watch your data come in!
Questions? Email us at email@example.com or chat in on the site.