In this tutorial, you'll learn how to fetch data from an external API in Airtable. You'll connect to the REST countries API and import the names, flags, regions, and populations of countries into an Airtable base.
An external API is a web service that you can use to connect with other applications and web services outside Airtable. External APIs especially come in handy when importing data from another platform into Airtable.
In the following sections, we'll create a request in Data Fetcher and import data from the REST countries API.
1. Add the Data Fetcher extension to your Airtable base.
2. Once you’ve added the extension, sign in to Data Fetcher or sign up if you don’t have an account.
3. Once you've logged in to Data Fetcher, click Create your first request.
Follow these steps to configure the request:
1. Under Application, select Custom.
2. Name the request "Fetch countries data".
3. Enter https://restcountries.com/v3.1/all
under URL. Make sure the request's method is GET.
If we run the request now, it will return many country-related data we're not interested in. We'll add parameters to the request so it returns the fields we want in the response data.
4. Click + Add under Parameters.
5. Enter fields
under Parameter, then name,flags,region,population
under Value.
6. Click Save and Run in the bottom right corner.
Once you've completed the previous steps, Data Fetcher will connect to the external API and take you to Response Field Mapping. On this page, you'll select and configure the fields you want to import from the response data.
If you want to see the raw JSON response from the external API, you can click the right arrow icon (->) in the top left of the screen to open the settings sidebar, then click "Response preview".
Notice how multiple fields start with "Name" and "Flags". This API returns different names of countries based on how they're called around the world. As for the flags, the API returns two image types and a description of the flag. We only need a country's common name and one flag image, so we'll deselect the other fields and pick the ones we want.
1. Click Deselect All.
2. Select the following fields and use the mapping below:
3. Click Save and Run in the bottom right corner.
Check your output table and you should see the list of countries and their data.
Let's summarize the steps for connecting to an external API in Airtable:
That's all for this tutorial. Check out our blog to see what other external API requests you can make with Airtable and Data Fetcher.
Oct 7, 2024
•Zayyad Muhammad Sani
•Custom RequestsData FetcherSep 20, 2024
•Zayyad Muhammad Sani
•Custom RequestsAug 20, 2024
•Zayyad Muhammad Sani
•Custom Requests