How to modify a Link To Table field?

Are you using our SaaS platform (Baserow.io) or self-hosting Baserow?

Self-hosted

If you are self-hosting, what version of Baserow are you running?

Baserow 1.30.0

If you are self-hosting, which installation method do you use to run Baserow?

I don’t know and don’t think it is relevant.

What are the exact steps to reproduce this issue?

I am trying to update a single field in a row. The field is a Link To Table field.

Update data:
{'field_11772': [ ]}

Sending an empty list works fine which will obviously empty the field.

But I cannot update the row, even sending back the same data as was retrieved from the API

API docs show:

"field_11772": [
        {
            "id": 0,
            "value": "string"
        }
    ],

An example update request sending the same data as was retrieved:
Update data:
{'field_11772': [{'id': 1, 'value': '38e8b53e-be67-4512-8c91-c897ee01134b', 'order': '1.00000000000000000000'}]}
This failed but I don’t think the order should be in the update request.

My request with the order removed:
Update data: {'field_11772': [{'id': 1, 'value': '38e8b53e-be67-4512-8c91-c897ee01134b'}]}
Also failed.

The only thing that seems to work is sending an empty list.

Error given:
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url

Please help. Many thanks.

This issue has been solved by AI.

The Link To Table field should be an array containing row ids. For example [1,2,3] then it should be sent in the request as JSON.

{
  "field_11772": [1, 2, 3]
}

Have to remember when using the Baserow API that the format of the existing data can be different to the format when sending an update request.