logo
การพัฒนา
ค้นหา
Update Table Data

Update Table Data

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

Request Method

POST

Endpoint

https://api-${endpoint}.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-${endpoint}.gptbots.ai/v1/database/update/record' \ -H 'Authorization: Bearer ${API Key}' \ -H 'Content-Type: application/json' \ -d '{ "table_id": "673af861ed69656ac0895b07", "record_id": "123456", "filter": { "id": "789" }, "updated_fields": { "name": "99990", "age": "30" } }'
                      
                      curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/database/update/record' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
  "table_id": "673af861ed69656ac0895b07",
  "record_id": "123456",
  "filter": {
    "id": "789"
  },
  "updated_fields": {
    "name": "99990",
    "age": "30"
  }
}'

                    
บล็อกโค้ดนี้ในหน้าต่างลอย

Request Headers

Field Type Description
Authorization Bearer ${API Key} Use Authorization: Bearer ${API Key} for authentication. Get API key from API Key page.
Content-Type application/json Data type, value is 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 Custom filter conditions (must use custom unique primary key fields).
updated_fields list Yes Set of data to be updated.
is_add boolean No Whether to add a new record if the target record does not exist.

Response

Response Example

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

                    
บล็อกโค้ดนี้ในหน้าต่างลอย

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