获取数据表列表
获取数据表列表
可以通过该接口获取指定 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} | 使用 Authorization: Bearer ${API Key}进行调用验证,请在 API 密钥页面获取密钥作为 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 | 系统内部错误 |
