Apr 05, 2021 10:55 AM
Hi all
I’m trying to update records in a table using vanilla javascript (because I’m building a Bookmarklet, so curl or node won’t work). I’m stuck on a user error “Unprocessable Entity” and the response is of type “cors”, so perhaps there is something wrong with my request headers?
fetch("https://api.airtable.com/v0/appfiPFiZHqEAsjAJ/Table%201",
{
method: "patch",
headers: {
"Authorization": "Bearer MY_KEY",
"Content-type": "application/json",
"accept": "application/json"
},
body: {
"records": [
{
"id": "recSKCdIGgAGRUc5c",
"fields": {
"Field One": "Bla",
"Field Two": "BlaBla",
"Field Three": "Blubb",
}
}
]
}
})
This returns:
Any pointers would be much appreciated.
Solved! Go to Solution.
Apr 05, 2021 12:46 PM
Hey @Dennis_Drees
I believe with fetch()
you have to JSON.stringify()
your body
property, yeah?
– Anthony
Apr 05, 2021 12:46 PM
Hey @Dennis_Drees
I believe with fetch()
you have to JSON.stringify()
your body
property, yeah?
– Anthony
Apr 05, 2021 01:38 PM
FACEPALM!
Many thanks, @acco !
Apr 05, 2021 02:43 PM
Been there, done that many times :grinning_face_with_sweat: Happy that was it