Use table values in requests
Last updated
Last updated
You can use values from your tables in requests. You do this by creating table references, which are replaced with the actual table data when the request runs.
There are two different ways to do this:
Run on multiple records: this will run a separate request for each record in a table. For example:
Lookup the stock price for every record in a view based on its Ticker field.
Fetch more info about each course in a table based on its Course ID field.
Use the value in a single cell: this will run one API request, with the reference replaced by the value in a single Airtable cell. For example:
Use an Airtable formula field to create a date string for yesterday, and use this string in a request URL.
Store an access token in an Airtable cell (assuming your base is private) and use this in an authorization header.
Click the + button in any input to open the table reference modal.
On the modal that opens, select the Table and Field you want to reference.
Under Run for every record in view, select the view on which you’ll run the request. Do not select an individual record.
Click Confirm. The input will now contain a reference to the table and field.
When the request runs for each record in the view, the reference will be replaced with the value for each record in that field. Each record in view will use one run in your monthly usage.
The Run on Multiple Records table and view will automatically be set to the table and view you selected, but if you want to confirm or change this:
Click â–¼ Advanced settings to open the advanced settings.
Under Run on Multiple Records, select the table and the view you want to use. The table must be the same as the one referenced in your input.
When you are running on multiple records, you should keep Update based on field(s) set to "None". The output record's position in the Run on Multiple Records table/view will then be used to update it.
Turn on the "If one of these records causes an error, run the next request anyway." switch if you want Data Fetcher to ignore errors and move on to the next record when the requests run.
When scheduling requests with this option enabled, the request will be paused if there are errors for 100 consecutive scheduled records/runs. You will be notified after this happens so that you can fix the request.
Click the + button in an input to open the table reference modal.
Select the Table and Field you want to reference.
Select the record with the cell's value you want to use.
Click Confirm.
The input will now have a reference to the cell.
When the request runs, the reference will be replaced by the cell value in that cell.
You can edit a table reference at any time by clicking it to re-open the table reference modal.
If you need to reference dynamic values, you can use an Airtable formula field to get these values, then reference them using the single value method described above.
Let's say we want to use the current date and time in our request's parameters with this format: 2023-03-22 12:00:00.000
.
Create a table in Airtable called "Config". Creating a new table keeps things cleaner.
Delete all the records apart from one.
Create an Airtable formula field called "Date today" with this formula:
The cell will now have a dynamic value in it:
Create a single value reference to this cell.
Your parameter will now have a reference to the formula field. When the request runs, it will be replaced by the latest date value in that cell. This works for both manual and scheduled/ automatic Data Fetcher runs.
When referencing a table/cell in the URL, you might need to encode the values. Data Fetcher has the option to do this automatically. On the table reference modal, use the Encode URL table references option at the bottom to turn this behaviour on or off: