如何通过HTTP API描述Collection

29 阅读1分钟

本文介绍如何通过HTTP API获取一个已创建的Collection的状态和Schema信息。


前提条件

Method与URL

HTTP示例:

GET https://{Endpoint}/v1/collections/{CollectionName}

使用示例

说明

  1. 需要使用您的api-key替换示例中的YOUR_API_KEY、您的Cluster Endpoint替换示例中的YOUR_CLUSTER_ENDPOINT,代码才能正常运行。
  2. 本示例需要参考新建Collection-使用示例提前创建好名称为quickstart的Collection

Shell示例:

curl -H 'dashvector-auth-token: YOUR_API_KEY' \
 https://YOUR_CLUSTER_ENDPOINT/v1/collections/quickstart

# example output:
# {
#   "request_id": "8d3ac14e-5382-4736-b77c-4318761ddfab",
#   "code": 0,
#   "message": "",
#   "output": {
#     "name": "quickstart",
#     "dimension": 4,
#     "dtype": "FLOAT",
#     "metric": "dotproduct",
#     "fields_schema": {
#       "name": "STRING",
#       "age": "INT",
#       "height": "FLOAT"
#     },
#     "status": "SERVING",
#     "partitions": {
#       "shoes": "SERVING",
#       "default": "SERVING"
#     }
#   }
# }

入参描述

参数Location类型必填说明
{Endpoint}pathstrCluster的Endpoint,可在控制台Cluster详情中查看
{CollectionName}pathstr您已创建的Collection名称
dashvector-auth-tokenheaderstrapi-key

出参描述

字段类型描述示例
codeint返回值,参考返回状态码说明0
messagestr返回消息success
request_idstr请求唯一id19215409-ea66-4db9-8764-26ce2eb5bb99
outputobject参考CollectionMeta