You need to enable JavaScript to run this app.
导航

list

最近更新时间2024.04.16 13:11:48

首次发布时间2023.11.03 15:00:09

概述

/collection/list 接口用于查询数据集 Collection 列表。

请求接口

说明

请求向量数据库 VikingDB 的 OpenAPI 接口时,需要构造签名进行鉴权,详细的 OpenAPI 签名调用方法请参见 API签名调用指南

URI

/api/collection/list

统一资源标识符

请求方法

GET

客户端对向量数据库服务器请求的操作类型

请求头

Content-Type: application/json

请求消息类型

Authorization: HMAC-SHA256 ***

鉴权

请求参数

无。

响应消息

参数

参数说明

code

状态码

message

返回信息

request_id

标识每个请求的唯一标识符

data

Collection 详情列表,每个 Collection 包含的字段详见 Collection 参数说明。

Collection参数

参数

子参数

类型

参数说明

collection_name

string

显示查询的 Collection 名称。

description

string

显示查询的 Collection 的描述。

primary_key

string

显示以下定义的某个 field_name 作为主键字段名称。主键的字段类型必须是int64 类型 / string 类型。

fields

field_name

string

显示自定义字段的名称。

field_type

string

显示自定义字段类型,可选值包含 int64、float32、string、bool、list<string>、list<int64>、vector、sparse_vector、text。其中,如果携带 text 字段,不允许再携带 vector 或 sparse_vector 字段。

default_val

和field_type一致

显示自定义字段默认值。

dim

int

显示自定义字段向量维度。

pipeline_name

纯文本。

index_names

array

显示 Collection 相关联的索引名字列表。

index_num

int

显示 Collection 相关联的索引个数。

create_time

string

数据集创建时间。

update_time

string

数据集更新时间。

update_person

string

数据集更新人。

状态码说明

状态码

http状态码

返回信息

状态码说明

0

200

success

查询 Collection 列表成功。

1000001

401

unauthorized

请求头中缺乏鉴权信息。

1000002

403

no permission

权限不足。

完整示例

请求消息

curl -i -X GET \
  -H 'Content-Type: application/json' \
  -H 'Authorization: HMAC-SHA256 ***' \
  http://***/api/collection/list \

响应消息

执行成功返回:

HTTP/1.1 200 OK
Content-Length: 43
Content-Type: application/json
 
{
    "code":0,
    "message":"success",
    "request_id":"021695029748777fd001de6666600000000000000000002887b8d",
    "data": [
        {
            "collection_name": "test_name",
            "description": "test dataset",
            "primary_key": "id", 
            "fields": [                               
                {
                    "field_name": "id",       
                    "field_type": "int64"
                },
                {
                    "field_name": "text",                     
                    "field_type": "string", 
                    "default_val": ""
                },
                {
                    "field_name": "vector_field",
                    "field_type": "vector",      
                    "dim": 768
                },
                {
                    "field_name": "sparse_vector_field",
                    "field_type": "sparse_vector"
                },
                {
                    "field_name": "time",
                    "field_type": "int64",       
                    "default_val": 0
                },
                {
                    "field_name": "author",
                    "field_type": "string",      
                    "default_val": "null"
                }
            ]
            "index_names": [
                "index1",
                "index2"
            ]
        "index_num": 2,            
        "create_time": "2023-11-21 12:22:57",
        "update_time": "2023-11-22 11:15:45",
        "update_person": "zhangsan"
        },
        {
            "collection_name": "test_name2",
            "descript": "test dataset 2",
            "primary_key": "id",
            "fields": [                               
                {
                    "field_name": "id",       
                    "field_type": "int64"
                }
                {
                    "field_name": "vector_field",
                    "field_type": "vector",      
                    "dim": 768
                }
            ]
            "index_names": [
                "index3",
                "index4"
            ]
        "index_num": 2,
        "create_time": "2023-11-21 10:22:57",
        "update_time": "2023-11-22 11:15:45",
        "update_person": "zhangsan"
        }
    ]
}

执行失败返回:

HTTP/1.1 401 OK
Content-Length: 43
Content-Type: application/json
 
{"code":1000001,"message":"unauthorized","request_id":"021695029748777fd001de6666600000000000000000002887b8d"}