Oct 11, 2024 12:13 AM
Hello,
I'm trying to run a script from BaseA to create a new record in BaseB. The new record in BaseB has a linked field, I followed this convention to reference it: Field_Name: [{id: record_id}]. I get INVALID_RECORD_ID error, though I've double-checked it and the record id is correct. What am I doing wrong?
let createRecordInBaseB = await fetch(
`https://api.airtable.com/v0/${targetBaseId}/${targetTableId}`,
{
method: "POST",
headers: {
Authorization: `Bearer ${baseARecord.pat}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
fields: {
"👀 Projects": [{id: projectRecordId}],
},
}),
}
);
Oct 11, 2024 08:16 AM
When using the web API, the cell value for a linked record field is an array of record IDs, not an array of objects.
https://airtable.com/developers/web/api/field-model#foreignkey
Oct 14, 2024 12:38 AM
Thanks for your answers, it works now