Airtable Cobuilder is here! Learn more about our new no-code app creation feature, powered by AI on the Airtable Academy

Curl command to update record(s) based on Name column

6041 7
Showing results for 
Search instead for 
Did you mean: 
5 - Automation Enthusiast
5 - Automation Enthusiast

I’ve spent hours, if not days, over the last year trying to figure out how to update a record. The api example code is nice, except I have no idea how to retrieve the correct record id from a name via a curl command. Obviously, I’m not the brightest person, so I’m willing to pay if someone could help me. I’ve googled endlessly and tried all kinds of URL encodings, looked at codepen, looked through these forums, and googled even more googles with magnitudes of googles. I am no closer to figuring this out than when I first discovered airtable over a year ago.

I just need to search for a name (example “1111111.tif”) in the table and update another column for that record via CURL.

Any help appreciated,

7 Replies 7

What is the name of the name of the Table these records you need to update are in?

And what is an example name of a field you would want to update, and its data type?

I’ll just use the following variables - for each, replace the entire variable with your data; the rest stays the same:

  • <<your base id here>> : Base ID can be obtained from your API docs
  • <<your table name here>> : This is the actual name of the table; make sure to escape non-URL friendly characters
  • <<your record id here>> : record id can be retrieved directly in your base by creating a formula field that uses the RECORD_ID() function (perhaps try using this as the “Name” field of your records to make URL searching more straightforward?)
  • <<your API key here>> : your API key can be obtained from your API docs
  • <<your field name here>> : Just as it appears in your base (no need to escape characters)
  • <<your data to add here>> : if the type is number, just put the number; if the type is text, put it inside double quotes; if the type is date, I believe you have to use ISO formatting, so between double quotes - “YYYY-MM-DD”

Here’s your curl command:

$ curl -v -XPATCH<<your base id here>>/<<your table name here>>/<<your record id here>> -H “Authorization: Bearer <<your API key here>>” -H “Content-Type: application/json” -d ‘{“fields”: { “<<your field name here>>”: <<your data to add here>> } }’

As I said, other than those variables, everything else in the formula stays the same, and that should work.

Thank you. I’ll give it a shot shortly. The name of the Table is ‘ImageList’ and the column that will change is ‘State’. It is a Single Select column.

$ curl -v -XPATCH<<your base id here>>/ImageList/<<your record id here>> -H “Authorization: Bearer <<your API key here>>” -H “Content-Type: application/json” -d ‘{“fields”: { “State”: "<<your data to add here>>" } }’

updated with your specifics – added " " around <<your data to add here>> because single-select fields take their input as a string (text).

Ah, that’s what I’m not getting (at all): how to find/retrieve the record ID/formula field. Thanks, tho.

Ya, you can reveal the record_id explicitly within Airtable… but you can’t search for a record by anything other than its record_id… for the obvious reason that any other field can contain duplicates, and that could not be resolved by the API.

Yeah, asking for help to retrieve the record id thru filter by formula using the name column, just can’t figure that part out. Back to where I was.