Help

Re: POST Request issues

3257 4
cancel
Showing results for 
Search instead for 
Did you mean: 
Andrew_Wingrave
6 - Interface Innovator
6 - Interface Innovator

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"
      }
    }
  ]
}
10 Replies 10

I have a hunch the answer is buried in this lengthy dialogue.

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:

zapier logs.txt

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,

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.

Andrew_Wingrave
6 - Interface Innovator
6 - Interface Innovator

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.

Hi @Andrew_Wingrave - which component in Zapier are you using to post the data to Airtable?

JB

I’m using…Webhooks.

Okay - so, if I take the response from Airtable (presumably to Zapier) it shows this -

image

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.

Andrew_Wingrave
6 - Interface Innovator
6 - Interface Innovator

Thanks Bill! This solved my issue. Working as intended now.

Appreciate the help!

Lucky guess.
(blah, blah, blah because Discourse won’t allow me to be brief)