Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Jan 28, 2020 05:45 PM
Hello, I’ve been trying all evening to get this to work, but I’m out of ideas:
I’m making the following request to the API, and getting nowhere - The fields are exactly as in the docs but I get the response:
Could not parse request body. This can occur if the information entered into a field is not in the correct format. Double-check that you are using the correct format for entering values into a field.
The problem is, it works perfectly in Postman, but when I run it in Zapier it falls apart. The JSON payload is as follows, and I’m using “User-Agent = Postman”
{
"records": [
{
"fields": {
"Gap Details": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur",
"Category ID": "12",
"Result ID": "726",
"Author ID": "4614"
}
},
{
"fields": {
"Gap Details": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur ",
"Category ID": "12",
"Result ID": "725",
"Author ID": "4613"
}
}
]
}
Jan 29, 2020 06:14 AM
I have a hunch the answer is buried in this lengthy dialogue.
Jan 29, 2020 07:20 AM
Thanks for this - I came across this User-Agent issue a while back, and I don’t think it’s that -
This is basically saying my JSON is unprocessable - So I’d wager that there’s an issue with that.
Here’s the full request and response of the attempt:
It looks like Airtable is not giving Zapier back anything more specific than that something is invalid in the body.
… Zapier support sent me to Stack Overflow…So they don’t know what’s happening here.
As I mentioned, the JSON is valid - When I run the request through Postman, it works… So my best guess is there’s a conflict with Airtable somewhere - But don’t have any info to work with. :expressionless:
Based on this response, for some reason it looks like some of my request is being stripped when being processed by Airtable… I might message AT support,
Jan 29, 2020 07:37 AM
Yet, the text file you reference indicates a 422 error. So which is it - Postman fails; Zapier works?
This is the big issue with glue-factories; they don’t really offer an easy way to debug processes.
I suspect values you are setting as strings are being changed into numbers in Zapier or vice-versa. This is typically the cause of Airtable API rejections - simply a type mismatch. This is also why I tend to avoid these abstract integration adhesives as well as SDKs and cod from scratch - I always know when and when a request has failed. And, I can shape services for automatic retry, alerting, and machine learning to make processes less brittle.
If you are technical enough to use Postman, you should also be able to frame the same call directly to the Airtable API with Google Apps Script.
Jan 29, 2020 07:45 AM
The text file I sent was Zapier (from their logs)
Postman works 100% of the time.
I don’t really love Google apps, and actively avoid them whenever possible - But thanks for the feedback.
Jan 29, 2020 08:38 AM
Hi @Andrew_Wingrave - which component in Zapier are you using to post the data to Airtable?
JB
Jan 29, 2020 08:53 AM
I’m using…Webhooks.
Jan 29, 2020 03:14 PM
Okay - so, if I take the response from Airtable (presumably to Zapier) it shows this -
Note the newline characters scattered throughout the response payload. At first I thought this was probably just a formatting issue with the response text, but I don’t think that’s true. Note the response section at the bottom where the runtime meta data is shown - no \n characters. This suggests that the newline characters may be in the original request and Postman (to Airtable) is possibly sanitizing these, (because it’s a web app and web apps tend to do that) thus allowing it to work.
The noted failure (422 error) is precisely what you would see if the payload included these errant newline characters. I just tested one and got exactly this error.
Jan 29, 2020 04:24 PM
Thanks Bill! This solved my issue. Working as intended now.
Appreciate the help!
Jan 29, 2020 04:34 PM
Lucky guess.
(blah, blah, blah because Discourse won’t allow me to be brief)