向量数据库VikingDB
/api/v1/fs/stat 接口用于获取 OpenViking 文件系统中文件或目录的状态信息,包括名称、大小、文件模式、修改时间等。
完成 API 鉴权说明 页面的 API Key 获取后,可调用本接口获取资源状态。
URI | /api/v1/fs/stat | 统一资源标识符 |
|---|---|---|
请求方法 | GET | 客户端请求类型 |
请求头 | Authorization: Bearer | Bearer Token 鉴权 |
参数 | 类型 | 必选 | 默认值 | 备注 |
|---|---|---|---|---|
uri | string | 是 | -- | Viking URI |
字段 | 参数说明 |
|---|---|
status | 请求状态,成功为 |
result | 成功时返回的数据对象 |
result.name | 文件或目录名称 |
result.size | 大小(字节) |
result.mode | 文件模式 |
result.modTime | 修改时间,ISO 8601 格式(如 |
result.isDir | 是否为目录,目录为 |
telemetry | 遥测信息,通常为 |
error | 失败时返回的错误对象 |
error.code | 错误码字符串,常见值见下表 |
error.message | 可读的错误描述 |
常见错误码:
error.code | 说明 |
|---|---|
UNAUTHENTICATED | 缺少或无效的 API Key |
PERMISSION_DENIED | 权限不足 |
INVALID_ARGUMENT | 无效参数 |
INVALID_URI | 无效的 Viking URI 格式 |
NOT_FOUND | 资源未找到 |
curl -X GET "https://xxx/api/v1/fs/stat?uri=viking://resources/docs/api.md" \ -H "X-Api-Key: your-api-key"
执行成功返回:
HTTP/1.1 200 OK Content-Type: application/json { "status": "ok", "result": { "name": "api.md", "size": 1024, "mode": 420, "modTime": "2026-05-08T04:22:02Z", "isDir": false }, "error": null, "telemetry": null }
curl -X GET "https://xxx/api/v1/fs/stat?uri=viking://resources/docs/" \ -H "X-Api-Key: your-api-key"
执行成功返回:
{ "status": "ok", "result": { "name": "docs", "size": 0, "mode": 493, "modTime": "2026-05-08T04:19:55Z", "isDir": true }, "error": null, "telemetry": null }