向量数据库VikingDB
/api/knowledge/task/info 接口用于查询指定下载任务的状态、进度和结果
通过下载任务 ID(task_id)查询指定任务的状态、进度和结果。
完成 API Key 鉴权(在控制台获取 VIKING_API_KEY)后,可调用 API 接口实现查询指定下载任务的状态、进度和结果。
| URI | /api/knowledge/task/info | 统一资源标识符 |
|---|---|---|
| 请求方法 | POST | 客户端对知识库服务器请求的操作类型 |
| 请求头 | Content-Type: application/json | 请求消息类型 |
| Authorization: Bearer {VIKING_API_KEY} | 鉴权 |
| 参数 | 类型 | 是否必选 | 描述 |
|---|---|---|---|
| task_id | string | 是 | 要查询的任务唯一标识符,由创建下载任务接口返回。 |
| 字段 | 类型 | 子字段 | 子字段类型 | 描述 |
|---|---|---|---|---|
| code | integer | -- | -- | 状态码 |
| message | string | -- | -- | 返回信息 |
data | object | status | string | 任务状态
|
| percentage | integer | 任务进度,0 ~ 100 | ||
| attachment_link | string | 下载 TOS 链接 |
| 状态码 | http状态码 | 返回信息 | 状态码说明 |
|---|---|---|---|
| 0 | 200 | success | 成功 |
| 1000001 | 401 | unauthorized | 鉴权失败 |
| 1000002 | 403 | no permission | 权限不足 |
| 1000003 | 400 | invalid request:%s | 非法参数 |
| 400 | task not exist | 任务不存在 |
curl -i -X POST \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer {VIKING_API_KEY}' \ https://api-knowledgebase.mlp.cn-beijing.volces.com/api/knowledge/task/info \ -d '{ "task_id": "xxx" }'
执行成功返回:
HTTP/1.1 200 OK Content-Length: 43 Content-Type: application/json { "code": 0, "data": { "status": "success", "percentage": 100, "attachment_link": "https://example.com/path/to/document?X-Tos-Credential=REDACTED&X-Tos-Security-Token=REDACTED&X-Tos-Signature=REDACTED" }, "message": "success", "request_id": "02176578783344000000000000000000000ffff0a007f1ef31bf2" }
执行失败返回:
HTTP/1.1 400 Bad Request Content-Length: 43 Content-Type: application/json {"code":1000003,"message":"invalid request:task not exist","request_id":"02176897909291000000000000000000000ffffac130abbfb5dbd"}