How to insert a row through the API?

Hi guys,

This should be fairly simply, but I am unable to get it to work. I went through through the community posts to find an answer, but there aren’t many answered posts in regards to the API.

I’ve been using the API for a doc with Javascript, and have been successful so far for all calls that did not include any extra data / payload. All the GET and single DELETE calls work fine.

However, I am now struggling with getting a simple POST call to work, in order to insert a row in the table.

I keep on getting a 400 (Bad Request) error every time I try to call it.

Am I writing this wrong?

  let testData = {
'rows': [
    {
        'cells': [
            {'column': 'c-GQELzj3QQm', 'value': 'test'},
            {'column': 'c-ynl5mcaRjk', 'value': '#039BC3'}
        ]
    },
    {
        'cells': [
            {'column': 'c-GQELzj3QQm', 'value': 'test2'},
            {'column': 'c-ynl5mcaRjk', 'value': '#99beE1'}
        ]
    }
]
}

  function AddSingleRow() {
$(document).ready(function () {
  $.ajax({
    url: urlStart + WarehouseMapId + "/tables/" + TestTableId + "/rows/",
    type: "POST",
    data: testData,
    headers: {
      "Authorization": token
    },
    success: function (result) {
      console.log("Deleted row: " + selectedRowsPayload)
    },
    error: function (error) {
      alert(error);
    }
  });
});
  };