logo
開發者文件
搜尋
更新表格資料

更新表格資料

此介面可用於更新代理資料表中特定紀錄的值。

請求方法

POST

端點

https://api-${endpoint}.gptbots.ai/v1/database/update/record

認證

詳細資訊請參考 API 概覽 的認證方式。

請求

請求範例

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

                    
此代碼塊在浮窗中顯示

請求標頭

欄位 類型 描述
Authorization Bearer ${API 金鑰} 使用 Authorization: Bearer ${API 金鑰} 進行認證。API 金鑰可於 API Key 頁面取得。
Content-Type application/json 資料類型,值為 application/json。

請求主體

欄位 類型 必填 描述
table_id string 表格 ID。
record_id string 紀錄 ID 或篩選條件,擇一使用。建議使用紀錄 ID。
filter map 自訂篩選條件(必須使用自訂唯一主鍵欄位)。
updated_fields list 要更新的資料欄位集合。
is_add boolean 若目標紀錄不存在,是否新增紀錄。

回應

回應範例

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

                    
此代碼塊在浮窗中顯示

成功回應

欄位 類型 描述
code int 訊息類型代碼。
message string 訊息描述。
data object 回應內容,包含資料表唯一識別碼。

失敗回應

欄位 類型 描述
code int 錯誤代碼。
message string 錯誤詳情。

錯誤代碼

錯誤代碼 訊息
40000 參數錯誤
50000 系統內部錯誤
403106 找不到表格
403131 無法訪問資料表