Airtable API Part 1: Generate your Airtable access

This is part one of our tutorial series on working with the Airtable API in dashdash. Just make sure that you’ve set up your views as in the introductory article.

Overview

In this tutorial, we’ll learn how to create the authorization header for Airtable.

We’ll go through how to:

  • set up the request header
  • set up the action URL

But first, let’s set up our Support view by creating the following header rows:

Cell Content
A1 Authorization
B1 Bearer
C1 API Key
D1 Bearer and Key
E1 Request Header
A4 URL
B4 Base ID
C4 View Name
D4 Action URL

It should look a little like this:

Next, let’s set up the request header.

Setting up the request header

In order to set up the header, we first need to get our Airtable API key. You’ll only need to do this step once per Airtable account.

To get you Airtable API key:

  1. Go to your Airtable account overview at www.airtable.com/account.
  2. Click Generate API key.
  3. Copy and paste your API key into cell C2 in the Setup view.

Great! Now we can access the Airtable API documentation.

  1. Go to https://airtable.com/api.
  2. Select the Airtable base you want to use. For the purposes of this tutorial, we’ll use the Content calendar base.
  3. In the left-hand navigation menu, select Authentication.

In the example on the right, we can see how to build our request header:

To build this header, let’s enter the following content in our Setup view.

Cell Content Description
A2 Authorization Used in the API header.
B2 Bearer Used in the API header.
C2 (This should already contain your API key) Our Airtable API key.
D2 =CONCATENATE(B2,” “, C2) This formula will concatenate Bearer with our API key.
E2 =PAIR2JSON(A2,D2) This formula will create the JSON header we need to send in each of our requests to AirTable.

If you’ve done everything correctly, in the end when you click the Data Explorer Data Icon icon in cell E2, you should see this in the data explorer panel.

Perfect! Now we have our header! The next thing we need to do is to set up the action URL (the URL that we’ll use to send data to).

Setting up the action URL

To set up the full action URL, we’ll need to get the following information from our Airtable API documentation:

  • URL
  • Base ID (this changes per Airtable base)
  • View name (this changes per Airtable view)

Luckily, the Airtable documentation provides us with all the information we need! If we look back at the Authentication section, you’ll notice the URL is already provided.

So now, let’s just update our Setup view with the following content:

Cell Content
A5 https://api.airtable.com/v0
B5 Your Base ID
C5 Your View name
D5 =CONCATENATE(A5,"/",B5,"/",C5)

The last formula, in cell D5, will create our entire action URL - perfectly formatted :slight_smile:

:memo: Note: If you have spaces in your view name, we need to URL encode them. Basically, we need to replace all your spaces with %20. For example, if your view name is dashdash is awesome, then in C5 you should write: dashdash%20is%20awesome

In the end, your Setup view should look like this:

Summary

And that’s it! You’ve just created all the necessary parts to start retrieving data from Airtable. So let’s get some data!

Up next: Part 2 - Get Data from your AirTable account

1 Like