Airtable POST/PATCH errors solved
Marko Kolombo
Posted on July 15, 2019
After a frustrating evening I finally found out WHY the Airtable API was always rejecting my humble POST/PATCH requests, a.k.a. requests that needed parameters to be sent as body.
I was stuck at some errors:
{“type”:“INVALID_REQUEST_MISSING_FIELDS”,“message”:“Could not find field “fields” in the request body”}}.`
{"error":{"type":"INVALID_REQUEST_UNKNOWN","message":"Invalid request: parameter validation failed. Check your request data."}}
{“error”:{“type”:“INVALID_REQUEST_BODY”,“message”:“Could not parse request body”}}
THE SOLUTION WAS...just to add this to the json: "typecast:true".
Yes, everything else was ok.
From the Airtable's API documentation:
"The Airtable API will perform best-effort automatic data conversion from string values if the typecast parameter is passed in (click to show example). Automatic conversion is disabled by default to ensure data integrity, but it may be helpful for integrating with 3rd party data sources."
To be honest this was a bit hidden, but hey, I'm writing this post specially for you, struggling for the win (read: for myself when I'll forget).
An example json
`javascript
{
"fields": {
"customer": [
"recMmE0pTasdGqkEw"
],
"date": "2019-07-15",
"from": "2019-06-15",
"to": "2019-06-30",
"currency": "USD"
},
typecast:true
}
`
edit:
I just found out that after I sent the request with typecast:true, now all the requests are passed smoothly without an error!
Posted on July 15, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.