Skip to main content
Solved

422 Server Error when testing POST from Voiceflow using API

  • February 22, 2024
  • 8 replies
  • 243 views

Forum|alt.badge.img+3

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?

Best answer by Wellhr-org

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

8 replies

TheTimeSavingCo
Forum|alt.badge.img+31

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


Forum|alt.badge.img+1
  • New Participant
  • March 20, 2024

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" } }

Forum|alt.badge.img+3
  • Author
  • New Participant
  • March 20, 2024

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 


Forum|alt.badge.img+1
  • New Participant
  • March 21, 2024

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


Forum|alt.badge.img
  • New Participant
  • July 12, 2024

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


Forum|alt.badge.img+3
  • New Participant
  • Answer
  • October 3, 2024

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


Forum|alt.badge.img+3
  • Author
  • New Participant
  • October 4, 2024

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


Forum|alt.badge.img+1

hello new guy here i have the same problem and i verified everything you said above any solutions?