'blank gravity form entries with API

I'm trying to create an entry in a Gravity form via API post in Google Apps script.

An entry gets created but the values are showing blank. any insight of where I'm possibly going wrong would be appreciated.

Below is my code:

function gravityForms(){

const url = 'https://example.com/wp-json/gf/v2/forms/18/entries';

const payload = [{"2":"My name"}];

const options = {
    "method" : "post",
    "payload" : JSON.stringify(payload),
    "muteHttpExceptions" : true
  };
  
    options.headers = {    
    "Content-Type" : "application/json",
    "Authorization" : "Basic " + Utilities.base64Encode("ck_xxxxxxxxxxxx:cs_xxxxxxxxxxxxxxxxxx")
  };

const res = UrlFetchApp.fetch(url, options);

console.log(res.getContentText());

}

This is the response I get back in the logger

{"0":{"2":"My name"},"form_id":18,"id":3320}


Solution 1:[1]

I removed the [] from the entry object and it worked. funny since the examples show to add them.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jack