Update datatable row using the API

Hello,

I want to update the datatable’s row using the API. I am following the documentation here Update Rows

I am using TypeScript. My JSON body is :

  body: JSON.stringify(
        [
          { value: { SeqNum: seqNum }, id: rowId }
        ]
      )

This is as per the documentation, but I am getting error : 422

{
  status: 422,
  code: 'malform format',
  message: 'Rows array is required'
}

I also used the code provided in the documentation, but even that is not working.

Hey @ShivWad - it looks like the example in the docs is misformated, thanks for pointing that out.

{
  "status": 422,
  "code": "malform format",
  "message": "Rows array is required"
}

The message indicates that there should be an actual ‘rows’ parameter, the example in our docs just provides the value of that parameter rather than both the key:value pair.

POST: https://preview.threekit.com/api/datatables/{DATA_TABLE_ID}/rows

The real payload should look like this:

{
  "rows": [
    {
      "value": {
        "SeqNum": "seqNum"
      },
      "id": "rowId"
    }
  ]
}

Let me know if this helps.

1 Like

Hi @Will - It worked, thanks!

1 Like

Thank you @Will for sorting this out. I will take care of fixing the docs for future reference.