Help

Re: PATCH request not working

Solved
Jump to Solution
512 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Noob_Coder
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi all

I've been working on SAP Integration Suite for connecting to airtable and perform CRUD operations. I've created a integration flow for PATCH request in my suite and wanted to test it through POSTMAN by hitting the endpoint of PATCH iflow. The issue here is that even though i'm sending my json payload in the format of airtable PATCH request postman is throwing 500 error.

My table in airtable

Noob_Coder_3-1732016595150.png

Note that EmpID is also Single Line Text here


Below are my configurations of the integration flow i've created to perform a PATCH operation through POSTMAN.

Json payload i'm sending through postman to suite

{
            "id": "rec6jjMo9lBFpfI62",
            "fields": {
                "Location": "India",
                "EmpID": "4",
                "Name": "Tester",
                "Designation": "SAP FICO"
            }
}


In Https adapater 

Noob_Coder_0-1732017706952.png

 

Added a groovy script after start for fetching the airtable id through the json payload

Added Content modifier to update headers with bearer token, Content-Type and Accept (hardcoded bearer token in header itself as of now for testing. Will change it to dynamic value later)

Noob_Coder_0-1732015848637.png

Under exchange property i've added id to send it to the endpoint and body for checking the payload being sent.

Noob_Coder_1-1732015976120.png

The response of id and body that are going to be sent before i've got before adding request reply.

Noob_Coder_8-1732017518435.png

 

The HTTP adapter configurations are

Noob_Coder_4-1732016856580.png

 

Postman request

Noob_Coder_5-1732016968086.png

 

When i've checked the message monitoring my airtable ID is getting attached to the airtable PATCH endpoint but it shows the below error.

Noob_Coder_6-1732017181005.png

 

To double check whether i'm passing the correct ID i've even sent a get request and ensured that correct ID is being sent

Noob_Coder_7-1732017259743.png

 

 

 

 

 

 

1 Solution

Accepted Solutions
kuovonne
18 - Pluto
18 - Pluto

There are two ways of updating a record via the API. Your request seems to be a bit of a mashup of the two different methods.

One method is to update a single record at a time by accessing the endpoint/url for the single record. In this situation, the record ID is in the endpoint/url and not in the payload.

The other method is to update the a batch of records but include only one record in the array. In this situation, you use the endpoint of the table (not the record), and the body is shaped as Adam described in his post.

Other things to check:

- Does your personal access token have access to the base with the proper scope?

- Does the table or any fields have any permission limitations preventing the user from making edits?

 

You might also want to try accessing the API via a plain JavaScript fetch request, instead of Postman. It is relatively easy to do using Airtable scripting extension. To protect your personal access token you can use it in a new base that only you have access to and then delete the base afterwards.

See Solution in Thread

6 Replies 6

Could I confirm that you managed to get a PATCH request to Airtable directly working?  I didn't see a screenshot of a working PATCH request to Airtable but could have missed it, sorry!

Here's an example of the body of a PATCH request that updates multiple records if that helps:

{
  "records": [
    {
      "id": "recGlyHdHCHOMPwzK",
      "fields": {
        "URL": "www.google.com"
      }
    }
  ]
}
ScottWorld
18 - Pluto
18 - Pluto

@Noob_Coder 

Your code is not in the proper format that Airtable is expecting.

To make this easy for you, Airtable has created an interactive customized API guide that actually uses real data from your real base, and generates real code for you based on your real fields and real data.

You can get to this interactive customized guide by going to this Airtable REST API page, then scrolling down on the page and choosing the base that you want to work with.

Hope this helps! If you’d like to hire an expert Airtable consultant to help you with anything Airtable-related, please feel free to contact me through my website: Airtable consultant — ScottWorld 

kuovonne
18 - Pluto
18 - Pluto

There are two ways of updating a record via the API. Your request seems to be a bit of a mashup of the two different methods.

One method is to update a single record at a time by accessing the endpoint/url for the single record. In this situation, the record ID is in the endpoint/url and not in the payload.

The other method is to update the a batch of records but include only one record in the array. In this situation, you use the endpoint of the table (not the record), and the body is shaped as Adam described in his post.

Other things to check:

- Does your personal access token have access to the base with the proper scope?

- Does the table or any fields have any permission limitations preventing the user from making edits?

 

You might also want to try accessing the API via a plain JavaScript fetch request, instead of Postman. It is relatively easy to do using Airtable scripting extension. To protect your personal access token you can use it in a new base that only you have access to and then delete the base afterwards.

HI @kuovonne thank you so much for this one...after checking the solution of @TheTimeSavingCo for multiple record updation i didn't understand how to perform that and after your clarification on the solution for setting table as endpoint it worked as charm for my single record...Thank you!!

Thank you @TheTimeSavingCo ...idea of multiple record updation worked for me..Thank you so much once again😊

Thank you @ScottWorld for letting me know that airtable exclusively takes our base and gives the documentation for it...i've actually taken the code from the documentation and made my changes..Thank you😊