Skip to content

Update API

This document explains how to use the API to update records in a table.

Interface Description

Updates the field values of a specified record in a table.

Request Method

http
PATCH /api/bases/{base_id}/tables/{table_name}/records/{record_id}

Path Parameters

ParameterTypeDescription
base_idstringBase ID
table_namestringTable name
record_idstringRecord ID

Request Headers

http
x-bm-token: your_api_token
Content-Type: application/json

Request Body

json
{
  "field_name1": "new_value1",
  "field_name2": "new_value2"
}

Example Request

Basic Field Update

http
PATCH /api/bases/base123/tables/table456/records/rec789
Content-Type: application/json

{
  "name": "Updated Name",
  "description": "This is the updated description",
  "age": 26,
  "is_active": false
}

Response Format

Successful Response

json
{
  "id": "11",
  "name": "55po",
  "created_by": "usrIL1t20OwVvW9jXzT",
  "updated_by": "usrIL1t20OwVvW9jXzT",
  "created_at": "2024-11-20T17:30:12.000Z",
  "updated_at": "2024-11-20T17:30:27.000Z",
  "avatar": null,
  "creator": {
    "id": "usrIL1t20OwVvW9jXzT",
    "email": "[email protected]",
    "name": "Dylan"
  },
  "modifier": {
    "id": "usrIL1t20OwVvW9jXzT",
    "email": "[email protected]",
    "name": "Dylan"
  }
}

Error Response

json
{
  "message": "Validation failed"
}

Field Value Format Explanation

Request formats for different types of fields:

Basic Type

json
{
  "text_field": "new text content",
  "number_field": 456.78,
  "boolean_field": false,
  "date_field": "2023-02-01T00:00:00Z"
}

Select Type

json
{
  "single_select": "opt789",  // New option ID
  "multiple_select": ["opt111", "opt222"]  // New option ID array
}
json
{
  "single_link": "rec999",  // New record ID
  "multiple_link": ["rec111", "rec222"]  // New record ID array
}

Notes

  1. Only include the fields that need to be updated, and the fields not included will keep their original values.
  2. System fields cannot be updated through the API:
    • Creation time
    • Creator
    • Auto-increment ID
  3. When updating a record, the following fields are automatically updated:
    • Update time
    • Updater

Released under the MIT License.