Updating Cell Data with Baserow's REST API

Hello Baserow community,

I’m excited to share that I’ve recently discovered Baserow and its powerful REST API feature. This feature has convinced me to choose Baserow for my future MVP. Currently, I’m on the ‘Free Plan’ to explore its features and capabilities. However, I’m struggling to find documentation on how to update a specific cell based on certain criteria. For instance, in SQL, an operation like this:

UPDATE profile
SET Nickname = 'MOTW'
WHERE FirstName = 'Smith';

To give you a clearer picture, here are some random field IDs that I’ve used for illustration:

  • Table ID (profile): 111
  • Column ID (NickName): 1112
  • Column ID (FirstName): 1113
  • Column ID (DoB): 1114

I attempted the following approach:

[PATCH]: /api/database/rows/table/111/1112?user_field_names=true&filter__field_1113__equal=Smith

[Data]: {"NickName": "MOTW"}

However, this resulted in the following error response:
{“error”:“ERROR_ROW_DOES_NOT_EXIST”,“detail”:“The rows [‘1112’] do not exist.”}

I would greatly appreciate it if someone could guide me on the correct approach to updating a specific cell in Baserow using the REST API. Thank you for your assistance!

1 Like

Hi,

The number 1112 refers to the ID of the column NickName but it should refer to the unique ID of the row. This explains why you get the error that the row with that ID does not exists.

So, the correct structure of the URL is
[PATCH ]https://api.baserow.io/api/database/rows/table/{table_id}/{row_id}/?user_field_names=true

If you want to update all the rows:
[PATCH] https://api.baserow.io/api/database/rows/table/{table_id}/batch/?user_field_names=true

Regards
Frederik

2 Likes

Hello Frederik,

Thank you for your guidance! I appreciate your assistance.

I apologize for any confusion caused by my previous message. I understand now that the correct approach for updating rows in Baserow is based on the row’s unique ID, rather than using a filter condition on a specific field like FirstName, as I would like with SQL syntax.

Thank you for providing the correct direction. I’m looking forward to applying this approach and making the most out of Baserow’s REST API capabilities.