You need to enable JavaScript to run this app.
文档中心
向量数据库VikingDB

向量数据库VikingDB

复制全文
下载 pdf
文件系统操作
stat-资源状态
复制全文
下载 pdf
stat-资源状态

概述

/api/v1/fs/stat 接口用于获取 OpenViking 文件系统中文件或目录的状态信息,包括名称、大小、文件模式、修改时间等。

前置条件

完成 API 鉴权说明 页面的 API Key 获取后,可调用本接口获取资源状态。

请求接口

URI

/api/v1/fs/stat

统一资源标识符

请求方法

GET

客户端请求类型

请求头

Authorization: Bearer

Bearer Token 鉴权

请求参数

参数

类型

必选

默认值

备注

uri

string

--

Viking URI
要查询状态信息的文件或目录 URI。

响应消息

字段

参数说明

status

请求状态,成功为 "ok",失败为 "error"

result

成功时返回的数据对象

result.name

文件或目录名称

result.size

大小(字节)

result.mode

文件模式

result.modTime

修改时间,ISO 8601 格式(如 "2026-05-08T04:22:02Z"

result.isDir

是否为目录,目录为 true,文件为 false

telemetry

遥测信息,通常为 null

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
}
最近更新时间:2026.05.26 11:19:26
这个页面对您有帮助吗?
有用
有用
无用
无用