How to Make an HTTP GET Request in Airtable

Jun 24, 2024Andy Cloke

In this tutorial, you'll learn how to make HTTP GET requests in Airtable using the Data Fetcher extension. You'll get a list of football competitions from this football-data API and populate an Airtable base with the data.

What is an HTTP GET Request?

As the name implies, GET requests allow clients to fetch data from a web service on the Internet or a local network. We use GET requests directly or indirectly through Application Programming Interfaces (APIs). APIs allow applications or web services to communicate with each other using a set of rules. For example, you communicate with Instagram's API when you fetch the latest posts, but the app does all the hard work for you in the background.

GET requests are part of a group of HTTP request methods. Other methods include POST, PUT, DELETE, and PATCH. You can read more about the different HTTP methods here.

Installing Data Fetcher

Add the Data Fetcher extension to your Airtable base. 

Once you’ve added the extension, sign in to Data Fetcher or sign up if you don’t have an account.

sign up for data fetcher.png

How to Make an HTTP GET Request in Airtable

APIs usually offer multiple endpoints so that users can access different functionalities and retrieve specific data. The football-data API has many endpoints, such as teams, competitions, matches, persons, and areas. Since we want to import Spanish competitions data, we'll connect to the competitions endpoint.

Whenever you want to run a request in Data Fetcher, you'll combine the API's base URL with the path to an endpoint. In our case, we'll combine https://api.football-data.org/v4 with /competitions.

Follow the steps below to make an HTTP GET request in your Airtable base and fetch the competitions data:

1. Open Data Fetcher in your Airtable base, then click Create your first request.

create your first request logo 2 smaller.png

2. Select Custom under Application.

select_custom_request.png

3. Rename the request to "Import football competitions".

renaming_get_request.png

4. Copy and paste the competitions endpoint URL into the URL input.

http://api.football-data.org/v4/competitions

setting_competitions_endpoint_url.png

5. Click Add + under Parameters.

add_parameter_football-data.png

GET request parameters help filter the data you fetch from an API. We're adding the areas parameter to the request because we only want to fetch Spanish football competitions. If we're getting all football competitions, we'll run the request without the parameter.

6. Enter 'areas' under Parameter and '2224' under Value.

added_areas_parameter.png

The areas parameter tells the football-data API to return the competitions in the areas we specify in the request. Each area in the API has a unique ID, so we can include one or more IDs to fetch competitions from specific areas. In this case, we're only fetching competitions from Spain, which has an area ID of 2224.

url_with_areas_parameter.png

Notice how the URL has changed since we added the parameter. This is how URLs look with parameters applied; you've probably seen something similar in your browser address bar before.

7. Click Save and Run in the bottom right corner.

save_and_run_before_mapping_football-data.png

Mapping Response Fields

Data Fetcher will make the HTTP GET request, and take you to Response Field Mapping. On this page, you'll choose fields from the response data that you want to import into your table.

response_field_mapping_football-data.png

You can map each field to an existing field in your table using the Existing field option, or create a new field with the New field option. Data Fetcher predicts field types in the response data, but you can change a field's type using the dropdown next to the new field's name.

The response data contains 30 fields, but we'll only use 5 of them:

1. Click Deselect All.

deselect_all_fields_football-data.png

2. Click the checkbox next to the fields you want to keep and name them according to the mappings below.

Note: You'll have to scroll to the right to see some of the fields, or you can use the Find field search bar.

  • Competitions id -> New field Id
  • Competitions area name -> New field Area
  • Competitions name -> Existing field Name
  • Competitions type -> New field Type (change the field type to Single select)
  • Competitions current season start date -> New field Current season start date 

football-data_response_field_mapping_complete.png

3. Click Save and Run in the bottom right corner.

Check your output table, and you should see the list of Spanish football competitions.

spanish_competitions_data_imported.png

Adding Authorization and Headers to GET Requests

Besides parameters, you can add authorization and headers to your GET requests in Data Fetcher.

Authorization is used to get access to certain features of APIs or APIs that require user accounts. For example, football-data requires users to sign up for a plan to get access to other endpoints and make more requests per minute.

You can use authorization in Data Fetcher by clicking the Authorization tab, selecting the authorization type and entering your credentials.

authorization_tip_football-data.png

Request headers are information included in HTTP requests to give servers more details about the request a client sends. For example, a request might include a User-Agent header containing details about the user's browser and operating system. Other types of request headers are used for authentication, working with cookies, etc.

On the other hand, servers use response headers to send information to tell clients more about a response. Since we only make requests in Data Fetcher, we'll use request headers. You can learn more about headers in this article.

Use headers in Data Fetcher by clicking the Headers tab and adding the data you want to send.

headers_tip_football-data.png

Making GET Requests in Airtable Automatically

You can use Data Fetcher's Schedule feature to make HTTP GET requests in Airtable at specific intervals. This feature can come in handy if you're fetching match scores from the football-data API.

The Schedule feature is available on our paid plans, so follow these steps to upgrade and schedule your requests:

1. Open the request in Data Fetcher, and scroll down to the Schedule/Trigger/Webhook URL tabs. Select Schedule, and click Upgrade.

schedule upgrade button.png

2. Select the paid plan that suits you best and complete the payment process. 

3. Go back to your request in Data Fetcher and click I’ve done this under schedule.

schedule ive done this button.png

4. Click + Authorize.

schedule tab authorize button.png

5. Click Add a Base in the window that opens. Then select All current and future bases in all current and future workspaces so you don’t need to authorize Data Fetcher anytime you want to use it.

schedule-authorize-bases.jpg

6. Click Grant Access.

7. The schedule feature will now be turned on in Data Fetcher. Select the schedule you want, then click Save.

schedule_football_get_request.png

To recap, whenever you want to make GET requests in Airtable, using Data Fetcher:

  • Choose the API you want to use.
  • Read the API's documentation to get the endpoint URLs.
  • Find out if you need parameters, authorization, or headers for the request you want to make.
  • Follow the steps above to run the request and import data into your Airtable base.

If you're looking to save time, you can check out our guide on running cURL commands in Airtable with Data Fetcher. Data Fetcher will automatically import headers, parameters, and other request data when you run requests using cURL Commands.

Related Posts

How to Import Data into Airtable Without Duplicates

How to Import Data into Airtable Without Duplicates

Oct 7, 2024

Zayyad Muhammad Sani

Custom RequestsData Fetcher
How to Connect to an OAuth 1.0 API in Airtable

How to Connect to an OAuth 1.0 API in Airtable

Sep 20, 2024

Zayyad Muhammad Sani

Custom Requests
How to Make an HTTP POST Request in Airtable

How to Make an HTTP POST Request in Airtable

Aug 20, 2024

Zayyad Muhammad Sani

Custom Requests