Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

PATCH Request to Airtable using Node-RED gives "Could not find field "fields" in the request body"

Solved
Jump to Solution
1758 4
cancel
Showing results for 
Search instead for 
Did you mean: 
CarboneQuebec
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi, I don't have much experience with API requests. I am trying to understand how it all works. I am currently using Node-RED (visual Node.js) to process the requests. I was able to complete a GET request and i'm now trying to do a PATCH request to update data in Airtable.

I get the following error message when trying:

type"INVALID_REQUEST_MISSING_FIELDS"
message"Could not find field "fields" in the request body"
 
Here is the schema in question:
CarboneQuebec_0-1709152192587.png

I am unsure where the API is expecting the request body.

Here is my test JSON:

{
    "fields": {
        "CCISF": 5,
        "CORAMH": 5,
        "RJCCQ": 5
    },
    "typecast": true
}
 
Do I have to include all fields present in the table or only those i wish to update with the PATCH request?
 
Thank you.
1 Solution

Accepted Solutions
CarboneQuebec
5 - Automation Enthusiast
5 - Automation Enthusiast

After Further investigations, It appears the request body was sent via msg.payload and not msg.req.body.

I was finally able to do my PATCH resquest.

Thank you

See Solution in Thread

4 Replies 4

You only need to include the fields you want to update in a PATCH request

Hmm, your JSON looks fine to me, hopefully someone else can spot something

For what it's worth, I used your exact JSON in Postman and it worked fine.  You have a `Content-Type` set as `application/json` right?

Yes the HTTP Request node as a custom header with Content-Type application/json, see below:

 

CarboneQuebec_0-1709217601014.png

 

CarboneQuebec
5 - Automation Enthusiast
5 - Automation Enthusiast

My guess is that I am not sending the JSON to the place the API is looking for it.

I have tried multiple things:

CarboneQuebec_1-1709219487180.png

 

msg.req.body, msg.request.body, msg.body, msg.request, msg.req

The issue is that I don't know where the API is expecting the JSON.

Regards.

 

 

CarboneQuebec
5 - Automation Enthusiast
5 - Automation Enthusiast

After Further investigations, It appears the request body was sent via msg.payload and not msg.req.body.

I was finally able to do my PATCH resquest.

Thank you