Help

Re: PATCH request to update field via API in table

2752 0
cancel
Showing results for 
Search instead for 
Did you mean: 
J_M1
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi,

I am using a program to push thru updates to a running database via API. So far, I have been able to search by Username using the filter to return the appropriate ID. I then need to use the ID to locate that record. I am having trouble updating the appropriate field. Can you please show me how I structure the link or the PATCH request? I have tried a variation of the following, to no avail. Please help.

‘{“fields”: { “<>”: “<>” } }’

12 Replies 12
J_M1
5 - Automation Enthusiast
5 - Automation Enthusiast

OK i will try that out. Thank you so much!!!

ep_eric
4 - Data Explorer
4 - Data Explorer

Hi all,

===
EDIT 2: Problem persists (original post follows Edit 1)
I was able to perform this request only with a static text string. Replacing the static text (eg. "Help me out!") with an object from the JSON (in n8n) causes this to fail with error ERROR: The data in "Body Parameters" is no valid JSON. Set Body Content Type to "RAW/Custom" for XML or other types of payloads, a native n8n error.

Parameters are in JSON/RAW and Response format is JSON.

Setting Body content type to RAW/custom yields this error {"error":{"type":"INVALID_REQUEST_MISSING_FIELDS","message":"Could not find field \"fields\" in the request body"}}, which is likely an error native to Airtable.

Does Airtable's Long text field have specific input requirements?

===
EDIT 1: Solved-ish
Somehow I was able to get the following to update the field "My Long Text".

 

 

 

{
  "fields": {
    "My Long Text": "Help me out!"
  }
}

 

 

 

From Postman, suddenly one of my PATCH requests worked (raw / JSON). From there I went back to my automation software and now this same request worked too. Previously, "My Long Text" field was not showing up in GET requests because it had an empty value; perhaps that plays a role in not being able to initialize from API? Although Postman eventually got this to work.

I say "solved-ish" because I can't identify the problem before; only that I now have the solution. Also because I'm using the API key method which will be deprecated beginning of next year, so not the long-term solution either.
===

I'm in a similar situation as OP here, cannot for the life of me figure out the correct JSON body to send in the request to UPDATE a field in a record.

I can GET records so it's not an access issue, although my custom field "My Long Text" is not included in the returned JSON body - I confirm this field is not "hidden" on the base. I'm using API key to connect (via n8n). I was also able to APPEND records, albeit not correctly. I was able to send UPDATE request for a record without an error, but the body returned does not include my update to the field in the record (the JSON once again excludes my custom field "My Long Text"). It's just not included in the JSON, and no change is made on the base.

I have tried sending body of request as the following (with a variety of errors, of course):

 

 

{
    "records": [
      {
        "fields": {
            "My Long Text": "Here's some content"
        }
      }
    ]
}

 

 

*Note I am only trying to update one record, so rec ID would be included in the URL and thus I wouldn't need to include "records" in the body, according to the docs, but want to make it clear that I also tried this approach.

 

 

{
  "fields": [ {
    "My Long Text": "Here's some content"
  }
 ]
}

 

 

 

 

{
  "fields": {
    "My Long Text": "Here's some content"
  }
}

 

 

 

 

{
    "My Long Text": "Here's some content"
}

 

 

I also found the Field ID for "My Long Text" and tried that in place of the name string, with and without quotations.

Any help is appreciated. I'm here because I already exhausted all personal research options, including this vid that shows very specifically the GET and POST request bodies, which I have tried verbatim.

Having worked with many APIs, I have to say this one is baffling for sure. I just need to update a field in a record. Seems basic enough. Anyone see what I'm doing wrong?

Thanks,

Eric

 

 

Did you ever solve this? Would love to know your JSON body that enabled you to update a field in a record.

Thanks.

Eric