Help

Re: 422 Server Error when testing POST from Voiceflow using API

Solved
Jump to Solution
2553 1
cancel
Showing results for 
Search instead for 
Did you mean: 
StilMan25
5 - Automation Enthusiast
5 - Automation Enthusiast

I'm using a simple JSON to POST data to create a new record in Airtable.

I'm using Field IDs to prevent name changes from affecting the integration. I've replaced the actual field ID's below for this example, however I'm using the correct Field IDs in in my production environment.

I'm using variables captured from the chat to send to Airtable.

{
"records": [
{
"fields": {
"fld1": "{First_Name}",
"fld2": "{Last_Name}",
"fld3": "{eMail}",
"fld4": "{Boomo_Intent}",
"fld5": "{MCI_Copilot_Feedback}"
}
}
]

I've verified both my endpoint URL and Authorization API Key.

I've troubleshot this for a couple of days now including using ChatGPT but still get the following error:

{
"error": {
"type": "INVALID_REQUEST_MISSING_FIELDS",
"message": "Could not find field \"fields\" in the request body"
},
"VF_STATUS_CODE": 422,
"VF_HEADERS": {
"access-control-allow-headers": "authorization,content-length,content-type,user-agent,x-airtable-application-id,x-airtable-user-agent,x-api-version,x-requested-with",
"access-control-allow-methods": "DELETE,GET,OPTIONS,PATCH,POST,PUT",
"access-control-allow-origin": "*",
"airtable-datacenter-regions": "us-east-1",
"connection": "close",
"content-length": "115",
"content-type": "application/json; charset=utf-8",
"date": "Thu, 22 Feb 2024 13:49:19 GMT",
"etag": "W/\"etag value\"",
"server": "Tengine",
"set-cookie": "Cookie value",
"strict-transport-security": "max-age=31536000; includeSubDomains; preload",
"vary": "Accept-Encoding",
"x-content-type-options": "nosniff",
"x-frame-options": "DENY"
}
}

 I'm stuck... does anyone have any thoughts?

1 Solution

Accepted Solutions
Wellhr-org
4 - Data Explorer
4 - Data Explorer

I found the solution, you have to add

Content-Type
application/json 

in the HEADER and not as a PARAMETER

BTW I build www.wellhr.org give it a try

See Solution in Thread

7 Replies 7

Hm, that sorta looks fine?  Here's one that works for me:

{
  "records": [
    {
      "fields": {
        "fld88Ky0ssK0MIz9B": "1"
      }
    }
  ]
}

 If I were you I'd just test it one field at a time with Postman to see where the error was I think

Stride-up
4 - Data Explorer
4 - Data Explorer

Hey @StilMan25 did you found the error?
I am stuck with the same issue, and it works on Postman...

When I do the same request but with GET, I get a 200.
Here is my JSON, copy/pasted from airtable... (and yes I tried with "records" too)

{
  "fields": {
    "ThreadID": "123",
    "Date": "2024-03-20T16:23:00.000Z",
    "Transcript": "abc",
    "Subjects": "xyz"
  }
}

Nothing solved yet @Stride-up 

@StilMan25 maybe a workaround could be to call a make automation that calls airtable... Not at all optimal but it may work...
I don't have time to try it but wanted to let you know the idea

HjalteST
4 - Data Explorer
4 - Data Explorer

I had a similar issue. The problem was that i hadnt granted acess to a base when creating a personal access token.

Wellhr-org
4 - Data Explorer
4 - Data Explorer

I found the solution, you have to add

Content-Type
application/json 

in the HEADER and not as a PARAMETER

BTW I build www.wellhr.org give it a try

Thanks @Wellhr-org!

Much appreciated