更新 Tool
更新 Tool
支援更新指定組織下 Tool 的基礎資訊、API 定義與驗證資訊。
可以透過該 API,更新指定組織下的 Tool 基礎資訊、API 定義與驗證資訊。
請求方式
PUT
調用地址
https://api.${endpoint}/v1/org/tool/update
調用驗證
使用帳號級 DevKey / DevSecret 的 Basic 驗證,並要求調用帳號具備組織 Tool 管理權限。
請求
請求範例
curl -X PUT 'https://api.${endpoint}/v1/org/tool/update' \
-H 'Authorization: Basic ${BASIC_TOKEN}' \
-H 'Content-Type: application/json' \
-d '{
"org_id": "p-xxxx",
"tool_id": "tool-xxxx",
"name": "weather",
"display_name": "Weather Lookup",
"description": "Query current weather",
"logo": "https://cdn.example.com/weather.png",
"url": "https://api.example.com",
"show_request": true,
"api_schema": "{\"openapi\":\"3.0.0\",\"paths\":{}}",
"auth_provider": "Creator",
"auth_type": "Bearer",
"auth_key": "token"
}'
curl -X PUT 'https://api.${endpoint}/v1/org/tool/update' \
-H 'Authorization: Basic ${BASIC_TOKEN}' \
-H 'Content-Type: application/json' \
-d '{
"org_id": "p-xxxx",
"tool_id": "tool-xxxx",
"name": "weather",
"display_name": "Weather Lookup",
"description": "Query current weather",
"logo": "https://cdn.example.com/weather.png",
"url": "https://api.example.com",
"show_request": true,
"api_schema": "{\"openapi\":\"3.0.0\",\"paths\":{}}",
"auth_provider": "Creator",
"auth_type": "Bearer",
"auth_key": "token"
}'
此代碼塊在浮窗中顯示
請求標頭
| 欄位 | 類型 | 說明 |
|---|---|---|
| Authorization | Basic ${BASIC_TOKEN} | 使用 DevKey:DevSecret Base64 後的 Basic Token。 |
| Content-Type | application/json | 請求內容格式。 |
請求參數(Body Parameters)
| 參數 | 類型 | 說明 | required |
|---|---|---|---|
| org_id | String | 組織 ID。 | true |
| tool_id | String | Tool ID。 | true |
| name | String | Tool 名稱,最多 20 個字元。 | true |
| display_name | String | Tool 顯示名稱,最多 50 個字元。 | false |
| description | String | Tool 描述,最多 100 個字元。 | true |
| logo | String | Tool 圖示 URL。 | true |
| url | String | Tool 基礎 URL,必須為公網 http/https 地址。 |
true |
| show_request | Boolean | 是否在調用過程中顯示請求內容。 | true |
| api_schema | String | OpenAPI JSON Schema。未傳入時不更新 API 定義。 | false |
| auth_provider | String | 驗證提供方。未傳入時不更新驗證設定。 | false |
| auth_type | String | 驗證類型。 | false |
| auth_key | String | 驗證 key 或 token。 | false |
| auth_key_name | String | 驗證 key 顯示名稱。 | false |
| auth_key_tip | String | 驗證 key 提示。 | false |
| auth_secret | String | 驗證 secret。 | false |
| auth_secret_name | String | 驗證 secret 顯示名稱。 | false |
| auth_secret_tip | String | 驗證 secret 提示。 | false |
回應
回應範例
{
"code": 0,
"message": "OK",
"affect_count": 1
}
{
"code": 0,
"message": "OK",
"affect_count": 1
}
此代碼塊在浮窗中顯示
成功回應
| 欄位 | 類型 | 說明 |
|---|---|---|
| affect_count | Integer | 影響記錄數。 |
失敗回應
| 欄位 | 類型 | 說明 |
|---|---|---|
| code | Integer | 錯誤碼。 |
| message | String | 錯誤詳情。 |
狀態碼
| 狀態碼 | 說明 |
|---|---|
| 200 | 成功 |
| 400 | 參數錯誤 |
| 401 | 未授權 |
| 403 | 權限不足 |
| 429 | 請求過於頻繁 |
| 500 | 伺服器錯誤 |
