-
Notifications
You must be signed in to change notification settings - Fork 2
Airtable
Rachel Xie edited this page Apr 28, 2023
·
3 revisions
- API REFERENCE: https://airtable.com/developers/web/api/introduction
- There’s also a community-built API for Python specifically! Found here: https://pyairtable.readthedocs.io/en/latest/index.html
- This assumes you are using the API key, which will be deprecated (or possibly is deprecated by the time you read this). Sticking a personal access token for the right base (which is like the Airtable Excel .xslx file equivalent) in place of anywhere the API key is used will suffice.
- Every developer needs to create their own personal access token to be able to run anything Airtable-related — keep it secret for security
- For the time being we only need the data.records:read scope (and you’ll be able to set this when generating personal access token)
- Highly recommend at least skimming Airtable API > Examples section and Getting Started sections
- This assumes you are using the API key, which will be deprecated (or possibly is deprecated by the time you read this). Sticking a personal access token for the right base (which is like the Airtable Excel .xslx file equivalent) in place of anywhere the API key is used will suffice.
- There’s also a community-built API for Python specifically! Found here: https://pyairtable.readthedocs.io/en/latest/index.html
- Airtable API encoder: https://codepen.io/airtable/pen/MeXqOg
- Potentially handy?? Does also assume use of API key: https://dev.to/matthewvielkind/using-python-and-airtable-3bb7
- On OAuth: https://oauth.net/getting-started/ (Not currently making use of this)
- An Airtable environment has six main components:
- Workspace: a collection of bases
- Base: a collection of tables, looks like database, has all unique project information
- Table: like a spreadsheet, stores data in rows and columns
- View: different ways of looking at the data (grid view, gantt table view, gallery view, etc)
- Field: information; different field types include long data, image, date, audio
- Record: one row of the table
- (this website is extremely vague and confusing but is the source here: https://hevodata.com/learn/best-airtable-examples/)
- Uses REST api
- Means Representational state transfer: “a software architectural style that describes a uniform interface between physically separate components, often across the Internet in a Client-Server architecture” (Wikipedia)
- You can expect this API to conform to REST design standards
- More here: https://www.ibm.com/cloud/learn/rest-apis
- Means Representational state transfer: “a software architectural style that describes a uniform interface between physically separate components, often across the Internet in a Client-Server architecture” (Wikipedia)
- Log into Airtable account
- Go to developer hub by clicking on account icon in the upper right corner and choosing from the dropdown menu
- Click web developer api in the sidebar
- Scroll to the bottom of the introduction page
- Click on the base you want the base id for
- On this new page, should be a line that says “The ID for this base is [BASE ID HERE]”.
- Log into Airtable account
- Click on the account icon in the upper right
- Click on “Developer Hub”
- Personal Access Tokens should be an option in the sidebar, create from there
- Make sure your scope is set to read, and that the environment variable on both your computer and in your IDE is set so that it’s TEMP_KEY=[YOUR ACCESS TOKEN] (without the square brackets)
- for more help with this: https://airtable.com/developers/web/guides/personal-access-tokens
- When you do a search with it using
table.all(), you will get back results from that table in the form of a list containing a dict containing another dict that has all the data for one row of the table- outer list is list of search results
- outer dict contains ‘id’, ‘createdTime’, and ‘fields’ of a record (one row of the table)
- inner dict associated with the key ‘fields’ is going to have key that is column header, and value that is the value for that particular row