I have a board where I track ice cream names and the flavours they come in. Names are self generated where are flavours are common names such as vanilla or chocolate and so on.
I want to use the npm airtable code here:
https://www.npmjs.com/package/airtable
and what I want to achieve is if a new flavour is added to the list of flavours, I want to also add this new flavour to the list of options available on the Airtable multiple select field. I am trying to mimic the code here:
https://airtable.com/developers/scripting/api/field#update-options-async
const table = base.getTable("Tasks");
const selectField = table.getField("Priority");
await selectField.updateOptionsAsync({
choices: [...field.options.choices, {name: "Urgent"}],
});
However using the npm package it seems these functions are not available.
I also tried using Curl as below:
curl --request PATCH \
--url https://api.airtable.com/v0/meta/bases/{baseId}/tables/{tableId}/fields/{fieldId} \
--header 'Authorization: Bearer {myToken}' \
--header 'Content-Type: application/json' \
--data '{
"options": [{"name": "a"}, {"name":"b"}, {"name":"c"}]
}'
Using the curl above I wanted to see if I could add a, b, and c as options to the field. However I received the following error:
{
"error": {
"type": "INVALID_REQUEST_UNKNOWN",
"message": "Invalid request: parameter validation failed. Check your request data."
}
}
I am currently trying to understand if this is at all possible. Any guidance would be appreciated. 🙂