Re: Searching a Table to retrieve Multiple Records for an update using the API

718 0
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

I am working on putting together a “sync” with another system to our airtable base.
Basically i want to be able to pull a GET request on a members table on the field “CRM AGENT ID” and it find all the records with the matching ID’s.

for example. I check a CRM system and find these agent ID’s: 3, 60, 67, 30.
I then want to find those ID’s corresponding airtable records with a GET request.

Then update all of those records with a PUT.

Where i’m running into issues is the URL having the right search formula to search the field for all the agent ideas and return them all.

Hard to explain, but how can i do this?

2 Replies 2

Welcome to the Airtable community!

It sounds like you are trying to use filterByFormula with the REST API.

Build your formula using the Airtable interface to get the correct syntax for the formula. Then have your code create the string for the formula with the exact same syntax.

Some notes:

  • You need the record ID of a record to update it. Depending on how your system is set up, you might be able to get the record IDs (such as through a linked record field) without having to do additional api calls.

  • A PUT request is destructive. If you don’t want to clear unspecified fields, you may want to use a PATCH request instead.

Just wondering - couldn’t you eliminate all of these steps and fast-forward to the PATCH process by simply designing the “other” system to possess not only agent IDs, but the corresponding Airtable record IDs as well?

This seems extremely API-critical and likely to add unnecessary complexity when synching the two systems. Ideally, the “other system” simply needs to run a process to be fully informed about the agents record IDs. This could be done in an ad-hoc [frequent] update process or when the “other system’s” data is instantiated in Airtable to begin with.