Help

Re: Error Code 422 - INVALID_REQUEST_MISSING_FIELDS

2356 0
cancel
Showing results for 
Search instead for 
Did you mean: 
James311it
4 - Data Explorer
4 - Data Explorer
I am using Voiceflow to retrieve data and send it to Airtable via the API. However, I keep encountering the above error despite my request appearing to be correctly formatted

This is in my body.

 

 

{
  "records": [
    {
      "fields": {
        "first": "test",
        "second": "test2",
        "tel": "000000000",
        "email": "test@test.com"
      }
    }
  ]
}

 

 

 And in Airtable my table looks like this:

 

firstsecondtelemail

Any help would be good, thanks

8 Replies 8

Are you creating or updating records?

I am trying to create an entry. 

sflorez
5 - Automation Enthusiast
5 - Automation Enthusiast

@James311it 

I think you are close, try using JSON.stringify() on javascript objects to construct your body payload when making a POST request via the Airtable API. 

for example using the body you posted it would look something like this:

//script above
const data = [
    {
        fields: {
            "first": "test",
            "second": "test2",
            "tel": "000000000",
            "email": "test@test.com"
        }
    }
]

//example fetch call
const res = await fetch(exampleURL, {
    method: 'POST',
    headers,
    body: JSON.stringify({ records: data })
})

 

Sebastian at Stradia Partners

Hmm, could you provide a screenshot of the fields please?  I'd like to try replicating as, with all single line text fields your body works fine for me

Could I confirm you've set your content-type to JSON?  Maybe try setting typecast: true as well?

Hi,

The table is pretty straightforward, the only difference is I have two base documents. 
However I don't see why that would be a problem. 

table.PNG

I have messed with the table's names, and that's why they are different from my post request. 

So the table is the original, but I removed the spaces and tried to make the table names shorter when troubleshooting. 

Thanks for the screenshot!  Just wanted to check what the field types were as that may be causing an issue!

I take it you've set your content-type to JSON and have tried setting typecast: true as well?  If so, I'd suggest opening a ticket with Airtable support directly!

All the table fields are set to single-line text to simplify troubleshooting and avoid potential issues.

I am including a Content-Type header with the value application/json but am not using the typecast parameter set to true