向量数据库VikingDB
/api/v1/tasks 接口用于列出当前调用方可见的后台任务,支持按类型、状态、资源过滤。
完成 API 鉴权说明 页面的 API Key 获取后,可调用本接口列出任务。
URI | /api/v1/tasks | 统一资源标识符 |
|---|---|---|
请求方法 | GET | 客户端请求类型 |
请求头 | Authorization: Bearer | Bearer Token 鉴权 |
参数 | 类型 | 必选 | 默认值 | 备注 |
|---|---|---|---|---|
task_type | string | 否 | -- | 按任务类型过滤 |
status | string | 否 | -- | 按任务状态过滤 |
resource_id | string | 否 | -- | 按资源 ID 过滤 |
limit | int | 否 | 50 | 最多返回的任务条数 |
字段 | 参数说明 |
|---|---|
status | 请求状态,成功为 |
result | 成功时返回的任务列表 |
result[].task_id | 任务 ID |
result[].task_type | 任务类型 |
result[].status | 任务状态: |
result[].resource_id | 关联的资源 ID |
result[].created_at | 任务创建时间(Unix 时间戳) |
result[].updated_at | 任务更新时间(Unix 时间戳) |
result[].result | 任务结果(进行中时为 |
result[].error | 错误信息(无错误时为 |
error | 失败时返回的错误对象 |
error.code | 错误码字符串,常见值见下表 |
error.message | 可读的错误描述 |
常见错误码:
error.code | HTTP 状态码 | 说明 |
|---|---|---|
UNAUTHENTICATED | 401 | 缺少或无效的 API Key |
INVALID_ARGUMENT | 400 | 无效参数 |
curl -X GET "https://xxx/api/v1/tasks" \ -H "X-API-Key: your-key"
curl -X GET "https://xxx/api/v1/tasks?task_type=session_commit&status=running&limit=20" \ -H "X-API-Key: your-key"
执行成功返回:
HTTP/1.1 200 OK Content-Type: application/json { "status": "ok", "result": [ { "task_id": "uuid-xxx", "task_type": "session_commit", "status": "running", "resource_id": "a1b2c3d4", "created_at": 1770000000.0, "updated_at": 1770000005.0, "result": null, "error": null } ] }