

We will be using the GET method for our purposes here, which is to download data.
Airtable api code#
Once the library has been installed, the code for downloading Airtable data can be almost as simple as the two lines below: import requests response = requests.get(url, params=params, headers=headers)

The requests library bills itself as an “an elegant and simple HTTP library for Python, built for human beings.” It does the complicated work of sending any HTTP request type to a specific URL path with any desired parameters or custom headers. For Python users, this means we can use the requests library to access an Airtable API. Once you have clicked through and accessed the documentation, you might read that the API “relies on standard HTTP codes to signal operation outcomes”. The documentation for a specific Airtable base’s API can be accessed through the graphical interface by clicking “Help” in the top right corner and then selecting “API Documentation”. Data source: Campaign Volunteer/Supporter Management Database template by Robert Avruch.
Airtable api how to#
For Python users learning how to make API calls, this tutorial ( and the follow-up tutorial on Airtable uploads) is also designed to be a demonstration on how to use API calls on data that you might actually own and manage.įigure 2: Locating the API Documentation within the Graphical Interface. Most tutorials and coding bootcamps only demonstrate how to access select data made publicly available by web organizations like Yelp or Reddit. What follows is a step-by-step tutorial for downloading Airtable data into your Python program using the requests library and as little additional code as possible. While there are promising Python-Airtable wrappers in development (see here and here), adding another dependency to my Python code is not always the most elegant nor the most sustainable solution. Airtable’s official API client is exclusively for Javascript, and among community-built API clients Airtable has only endorsed clients for Ruby and C#. This is not an insurmountable obstacle, but it also isn’t necessarily made easy. The challenge, of course, is getting Airtable and Python to talk to each other.

If Airtable is my go-to data engineering tool, then Python is my go-to data science tool. Being open-source and freely available, Python easily fits into the spirit and budget of many of the nonprofits and social ventures I work with. If I can set up an Airtable just right and deploy it strategically within an organization, in due time I have a sizable enough dataset that I can do some data science magic on.įor me and many others, that “data science magic” takes place within the Python programming language, where I can write reusable code for data cleaning, webscraping, regressions, visualizations, and machine learning models. Airtable thankfully makes data easy to navigate and input within a relational data structure. Specifically, I find myself working within organizations -local nonprofits and social advocacy ventures - with relatively low data literacy and also with data needs that are characterized by more subjective metrics.
