Oct 09, 2024 01:42 AM
Hi there.
Can you help us solve this issue?
After generating the GoogleDrive URL in GAS, we update certain fields in airtable API.
The field type is “URL”.
The code is below. I have already confirmed that the API URL, PAT, GoogleDrive URL and field name I am calling are correct.
const drive_url = "https://drive.google.com/drive/folders/" + folder.getId();
const url = "https://api.airtable.com/v0/XXX(appID)/XXX(TableName)/XXX(recordId)"
const options = {
'method': 'PATCH',
'headers': {
'Authorization': 'Bearer ' + "XXX",
'Content-Type': 'application/json',
},
'payload': JSON.stringify({
'fields': {
'Field1': drive_url,
}
})
};
const response = UrlFetchApp.fetch(url, options);
Then the following error is returned. {“type”: “INVALID_VALUE_FOR_COLUMN”, “message”: “Field \”Field1\“ cannot accept a value because the field is computed”}}
However, the field type of Field1 is "URL", as mentioned above. It is not a calculated field.
Why does this error occur?
I am having trouble solving this problem.
Thanks in advance for your help.
Oct 09, 2024 02:28 AM - edited Oct 09, 2024 02:29 AM
Hm, as a data point, I just did an API call to update a URL field via Postman and it worked fine. Here's the Postman script:
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer [YOUR_API_KEY]");
const raw = JSON.stringify({
"fields": {
"URL": "New URL"
}
});
const requestOptions = {
method: "PATCH",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://api.airtable.com/v0/APPID/TABLEID/RECORDID", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
Oct 09, 2024 06:41 PM
Thank you for your answer.
I tried with Postman and got the same error.
Oct 09, 2024 06:42 PM - edited Oct 09, 2024 06:43 PM
Try creating another URL field and seeing whether that can be updated? Might want to open a ticket!
Oct 09, 2024 07:11 PM
When another URL field was created and run on the same table, it resulted in UNKNOWN_FIELD_NAME. There is no problem with the name and permissions.
Where can I open a ticket?
Oct 10, 2024 06:13 AM
Check out the docs here: https://support.airtable.com/docs/contacting-airtable-support?contact_support=true