Patch Request from google apps script

I just can’t find the right way to format my request. I’m trying to update a single field in a single record. but keep hitting - INVALID_REQUEST_MISSING_FIELDS",“message”:"Could not find field “fields” in the request body

Getting data is fine.

After a few hours trying different things I’m asking for help what am I missing? Any help appreciated

API and Base ID Blanked out

function apiCall(){

var root = ‘’;

var baseId = ‘XXXXXXXXXXXX’;
var tableName = encodeURIComponent(‘Travels’);
var recordId = “recSaJTXSBu1g8CBd”
var endpoint = ‘/’ + baseId + ‘/’ + tableName + ‘/’ + recordId;

var params = {
‘method’: ‘PATCH’,
‘muteHttpExceptions’: true,
‘Content-Type’: ‘application/json’,
‘headers’: {
‘Authorization’: 'Bearer ’ + API_KEY

    "fields" : {
      "Declaration link": ""


var response = UrlFetchApp.fetch(root + endpoint, params);

I think you have at least two issues:

  1. The API requires a record ID to tell it which record should be patched.
  2. The fields element is freely floating in the params object but should be contained in a payload element and stringified. (see example)

Thanks Bill , I did have the record id but the code is not super readable on the forum. Also I had tried with the payload also but I was getting the same error. But your code helped me see what I think was the mistake. The content type was stored outside of the headers in my params.

for others working code below.

1 Like

Use the preformatted text styler in the editor toolbar to format the code for easier reading. For multi-line code snippets, wrap the code in pairs of graves triplets → ```


// This is some code
let something = “Something”;


// This is some code
let something = "Something";
1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.