Update Table Data
Last updated:

Update Table Data

This interface allows you to update the values of specific records in the Bot data table.

Request Method

POST

Endpoint

https://api.gptbots.ai/v1/database/update/record

Authentication

For details, refer to the API Overview for authentication methods.

Request

Request Example

curl -X POST https://api.gptbots.ai/v1/database/update/record \ -H 'Authorization: Bearer your_apikey' \ -H 'Content-Type: application/json' \ -d '{ "table_id": "673af861ed69656ac0895b07" "record_id":"123456" //Choose either record_id or filter condition "filter": { "id": "789" }, "updated_fields": { "name": "99990", "age": "30" }, }'
          curl -X POST https://api.gptbots.ai/v1/database/update/record \ 
  -H 'Authorization: Bearer your_apikey' \ 
  -H 'Content-Type: application/json' \ 
  -d '{
      "table_id": "673af861ed69656ac0895b07"
        "record_id":"123456"  //Choose either record_id or filter condition
        "filter": {
        "id": "789"
        },
        "updated_fields": {
        "name": "99990",
        "age": "30"
        },
    }'

        
This code block in the floating window

Request Headers

Field Type Description
Authorization Bearer ${token} Use Authorization: Bearer ${token} for authentication. Obtain the token from the API key page.
Content-Type application/json Data type, set to application/json.

Request Body

Field Type Required Description
table_id string Yes Table ID.
record_id string No Record ID or filter condition, choose one. Record ID is recommended.
filter map No User-defined filter condition (e.g., custom unique primary key).
updated_fields list Yes Set of data to be updated.

Response

Response Example

{ "code": 0, "message": "OK" }
          {
    "code": 0,
    "message": "OK"
}

        
This code block in the floating window

Success Response

Field Type Description
code int Type code of the message.
message string Message description.
data object Response content, which includes the unique identifier of the data table.

Failure Response

Field Type Description
code int Error code.
message string Error details.

Error Codes

Code Message
40000 Parameter error
50000 Internal system error
403106 Table not found
403131 No access to the data table