logo
開發者文件
搜尋
編輯元資料欄位

編輯元資料欄位

批次編輯元資料欄位。僅可修改 display_label、description、ai_search_filter;只更新請求中有傳入的屬性,未傳入的屬性保持不變。一次最多編輯 50 個。

批次規則:
一次最多編輯 50 個,超過 50 整批不處理。
請求內 id 重複:僅保留第一組,其餘標記失敗。

請求方式

PUT

呼叫位址

https://api-${endpoint}.gptbots.ai/v1/bot/doc/metadata/field/update

呼叫驗證

鑒權方式請參閱 API 總覽

請求

請求範例

curl -X PUT 'https://api-${endpoint}.gptbots.ai/v1/bot/doc/metadata/field/update' \ -H 'Authorization: Bearer ${API Key}' \ -H 'Content-Type: application/json' \ -d '{ "fields": [ { "id": "665f1c8a9b2e4d001a3f0001", "display_label": "文件分類", "description": "文件所屬的業務分類", "ai_search_filter": false } ] }'
                      
                      curl -X PUT 'https://api-${endpoint}.gptbots.ai/v1/bot/doc/metadata/field/update' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
    "fields": [
        {
            "id": "665f1c8a9b2e4d001a3f0001",
            "display_label": "文件分類",
            "description": "文件所屬的業務分類",
            "ai_search_filter": false
        }
    ]
}'

                    
此代碼塊在浮窗中顯示

請求標頭

欄位 類型 描述
Authorization Bearer ${API Key} 使用 Authorization: Bearer ${API Key} 進行驗證。請前往 API 金鑰頁面取得 API Key。
Content-Type application/json 資料型,設定為 application/json

請求參數

欄位 類型 必填 說明
fields Array<Object> 要編輯的欄位列表,一次最多 50 個。
id String 元資料欄位 ID,用於定位欄位。
display_label String 新顯示名稱,最長 64 個字元。僅在傳入時更新,且必須唯一。
description String 新欄位說明,最長 50 個字元。僅在傳入時更新。
ai_search_filter Boolean 新的 AI Search 篩選設定。僅在傳入時更新。

回應

回應範例

{ "success_count": 1, "failure_count": 2, "results": [ { "id": "665f1c8a9b2e4d001a3f0001", "success": true }, { "id": "665f1c8a9b2e4d001a3f0002", "success": false, "error_message": "display_label already exists" }, { "id": "665f1c8a9b2e4d001a3f0001", "success": false, "error_message": "duplicate id in request" } ] }
                      
                      {
    "success_count": 1,
    "failure_count": 2,
    "results": [
        {
            "id": "665f1c8a9b2e4d001a3f0001",
            "success": true
        },
        {
            "id": "665f1c8a9b2e4d001a3f0002",
            "success": false,
            "error_message": "display_label already exists"
        },
        {
            "id": "665f1c8a9b2e4d001a3f0001",
            "success": false,
            "error_message": "duplicate id in request"
        }
    ]
}

                    
此代碼塊在浮窗中顯示

成功回應

欄位 類型 說明
success_count Integer 編輯成功的欄位數。
failure_count Integer 編輯失敗的欄位數。
results Array<Object> 逐欄位結果,依請求順序回傳。
id String 欄位 ID。
success Boolean 是否編輯成功。
error_message String 失敗原因:display_label already exists(展示名與已有衝突) / duplicate id in request(請求內 id 重複) / field not found(欄位不存在)。

失敗回應

欄位 類型 描述
code Integer 錯誤碼。
message String 錯誤詳情。