logo
開發者文件
搜尋
獲取資料表列表

獲取資料表列表

支援透過此 API 獲取指定 Agent 下的全部資料表列表,回傳每張表的基礎資訊(表名、描述、欄位數量、資料量等)。

請求方法

POST

端點

https://api-${endpoint}.gptbots.ai/v1/database/tables/page

認證

有關詳細資訊,請您參閱 API 概覽 中的認證方法說明。

請求

請求範例

curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/database/tables/page' \ -H 'Authorization: Bearer ${API Key}' \ -H 'Content-Type: application/json' \ -d '{ "agent_id": "680d1a2b3c4d5e6f7a8b9c0d" }'
                      
                      curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/database/tables/page' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
    "agent_id": "680d1a2b3c4d5e6f7a8b9c0d"
}'

                    
此代碼塊在浮窗中顯示

請求標頭

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

請求內容

欄位 類型 必填 描述
agent_id string Agent 唯一識別碼。

回應

回應範例

{ "tables": [ { "table_id": "680d1a2b3c4d5e6f7a8b9c0d", "name": "客戶資訊表", "description": "儲存客戶基礎資訊", "field_number": 8, "record_count": 1250 }, { "table_id": "680d1a2b3c4d5e6f7a8b9c0e", "name": "訂單表", "description": "儲存訂單資料", "field_number": 12, "record_count": 5430 } ] }
                      
                      {
    "tables": [
        {
            "table_id": "680d1a2b3c4d5e6f7a8b9c0d",
            "name": "客戶資訊表",
            "description": "儲存客戶基礎資訊",
            "field_number": 8,
            "record_count": 1250
        },
        {
            "table_id": "680d1a2b3c4d5e6f7a8b9c0e",
            "name": "訂單表",
            "description": "儲存訂單資料",
            "field_number": 12,
            "record_count": 5430
        }
    ]
}

                    
此代碼塊在浮窗中顯示

成功回應

欄位 類型 描述
tables list 資料表列表。
table_id string 資料表唯一識別碼。
name string 表名。
description string 表描述。
field_number int 欄位數量。
record_count int 資料量(資料列數)。

失敗回應

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

錯誤代碼

Code Message
40000 無效參數
50000 系統內部錯誤