使用 ListKnowledgeBase 接口分页查询当前 Project 下的所有知识库。
前提条件
已创建 AgentStorage 实例且状态为
normal,并获取实例访问地址(endpoint)和实例名。已创建 API Key。
请求参数
参数 | 类型 | 说明 |
| int | 返回数量。默认为 10,最大 100 |
| string | 翻页 token,首次请求不传 |
请求示例
使用 API Key 认证时,通过 x-ots-instancename 和 x-ots-apikey 请求头传入实例名和 API Key。
curl -X POST https://<endpoint>/ListKnowledgeBase \
-H "x-ots-instancename: <instance-name>" \
-H "x-ots-apikey: <your-api-key>" \
-H "Content-Type: application/json" \
-d '{"maxResults": 10}'响应
字段 | 类型 | 说明 |
| list<object> | 知识库列表,每项含 |
| string | 翻页 token,为空表示已到最后一页 |
{
"code": "SUCCESS",
"data": {
"knowledgeBases": [
{
"knowledgeBaseName": "product_docs_kb",
"description": "产品文档知识库",
"subspace": true,
"tags": ["产品", "文档"],
"createdAt": 1787636583092,
"updatedAt": 1787636583092
}
],
"nextToken": ""
},
"message": "succeed"
}该文章对您有帮助吗?