You need to enable JavaScript to run this app.
文档中心
向量数据库VikingDB

向量数据库VikingDB

复制全文
下载 pdf
知识服务
list
复制全文
下载 pdf
list

本节将说明如何查询某个知识库下的知识服务信息。

概述

/api/knowledge/service/list 接口用于查询某个知识库下的知识服务信息。

前提条件

完成“签名鉴权方式”页面的注册账号、实名认证、AK/SK 密钥获取和签名获取后,可调用 API 接口实现查看知识服务列表的功能。

请求接口
URI/api/knowledge/service/list统一资源标识符
请求方法POST客户端对知识库服务器请求的操作类型
请求头Content-Type: application/json请求消息类型
Authorization: HMAC-SHA256 ***鉴权
请求参数(旗舰版、标准版通用)
参数子参数类型是否必选默认值参数说明
filterjson否--过滤条件

collection_resource_ids

list

否

--

知识库 resource_id 列表
resource_id 可通过创建知识库接口的返回值或知识库列表接口获取
当前长度限制为1,仅支持单库查询,不传则根据其他条件返回当前 account 下所有库的知识服务

service_type

int

否

2

知识服务类型
1 代表检索服务
2 代表问答服务

page_numberint否1页码,最小值为 1;当前实现未设置最大页码。
page_sizeint否100每页条数,取值范围 [1, 100]。
响应消息
参数参数说明
code状态码
message返回信息
request_id标识每个请求的唯一标识符

data

  • total_count : 返回的知识服务个数
  • page_size:每页条数
  • page_number:页数
  • knowledge_services
    • name:知识服务名称
    • description:知识服务描述
    • service_type:知识服务类型
    • service_resource_id:知识服务 id

状态码说明

状态码http状态码返回信息状态码说明
0200success成功
1000001401unauthorized鉴权失败
1000002403no permission权限不足
1000003400invalid request:%s非法参数
1000005400collection not existcollection不存在
完整示例

请求消息

curl -i -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: HMAC-SHA256 ***' \
  https://api-knowledgebase.mlp.cn-beijing.volces.com/api/knowledge/service/list \
  -d '{
    "filter":{
        "collection_resource_ids": ["kb_xxx"],
        "service_type": 2
    }
}'

响应消息

执行成功返回:

HTTP/1.1 200 OK
Content-Length: 43
Content-Type: application/json
 
{
    "request_id": "0217734150**********4692d",
    "message": "success",
    "code": 0,
    "data": {
        "total_count": 2,
        "page_size": 100,
        "page_number": 1,
        "knowledge_services": [
            {
                "name": "test01",
                "description": "",
                "service_type": 2,
                "service_resource_id": "kb-service-**********c78e"
            },
            {
                "name": "test02",
                "description": "",
                "service_type": 2,
                "service_resource_id": "kb-service-**********cbcb"
            }
        ]
    }
}

执行失败返回:

HTTP/1.1 400 Bad Request
Content-Length: 43
Content-Type: application/json
 
{"code":1000005, "message":"collection not exist , please check your parameter", "request_id": "021695029757920fd001de6666600000000000000000002569b8f"}
最近更新时间:2026.09.08 20:33:16
这个页面对您有帮助吗?
有用
有用
无用
无用