获取文档版本信息
该接口用于获取文档或电子表格指定版本的信息,包括标题、标识、创建者、创建时间等。
请求
| 项目 | 值 |
|---|---|
| HTTP URL | https://open.feishu.cn/open-apis/drive/v1/files/:file_token/versions/:version_id |
| HTTP Method | GET |
| 接口频率限制 | 1000 次/分钟、50 次/秒 |
| 支持的应用类型 | custom,isv |
| 权限要求 调用该 API 所需的权限。开启其中任意一项权限即可调用 开启任一权限即可 | drive:drive:version 查看、创建、删除文档版本 drive:drive:version:readonly 查看文档版本 |
| 字段权限要求 | > Tip: 该接口返回体中存在下列敏感字段,仅当开启对应的权限后才会返回;如果无需获取这些字段,则不建议申请 contact:user.employee_id:readonly 获取用户 user ID |
请求头
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| Authorization | string | 是 | tenant_access_token 或 user_access_token 值格式:"Bearer access_token" 示例值:"Bearer u-7f1bcd13fc57d46bac21793a18e560" 了解更多:如何选择与获取 access token |
路径参数
| 名称 | 类型 | 描述 |
|---|---|---|
file_token | string | 源文档的 token。获取方式参考 如何获取云文档相关 token。 示例值:"shtbcqqoXZJaKYrfN5IHQgabcef" |
version_id | string | 版本文档的版本标识 示例值:"fnJfyX" |
查询参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
obj_type | string | 是 | 源文档的类型 示例值:docx 可选值有: - docx: 新版文档 - sheet: 电子表格 |
user_id_type | string | 否 | 用户 ID 类型 示例值:open_id 可选值有: - open_id: 标识一个用户在某个应用中的身份。同一个用户在不同应用中的 Open ID 不同。了解更多:如何获取 Open ID - union_id: 标识一个用户在某个应用开发商下的身份。同一用户在同一开发商下的应用中的 Union ID 是相同的,在不同开发商下的应用中的 Union ID 是不同的。通过 Union ID,应用开发商可以把同个用户在多个应用中的身份关联起来。了解更多:如何获取 Union ID? - user_id: 标识一个用户在某个租户内的身份。同一个用户在租户 A 和租户 B 内的 User ID 是不同的。在同一个租户内,一个用户的 User ID 在所有应用(包括商店应用)中都保持一致。User ID 主要用于在不同的应用间打通用户数据。了解更多:如何获取 User ID?默认值: open_id当值为 user_id,字段权限要求: contact:user.employee_id:readonly 获取用户 user ID |
响应
响应体
| 名称 | 类型 | 描述 |
|---|---|---|
code | int | 错误码,非 0 表示失败 |
msg | string | 错误描述 |
data | version | - |
└ name | string | 版本文档的标题 |
└ version | string | 版本文档的版本标识 |
└ parent_token | string | 当前版本对应的源文档的 token |
└ owner_id | string | 版本文档的所有者的 ID |
└ creator_id | string | 版本文档的创建者的 ID |
└ create_time | string | 版本文档的创建时间,Unix 时间戳,单位为秒 |
└ update_time | string | 版本文档的更新时间 |
└ status | string | 版本文档的状态 可选值有: - 0: 正常状态 - 1: 删除状态 - 2: 回收站状态 |
└ obj_type | string | 版本文档的类型 可选值有: - docx: 新版文档 - sheet: 电子表格 |
└ parent_type | string | 源文档的类型 可选值有: - docx: 新版文档 - sheet: 电子表格 |
响应体示例
json
{
"code": 0,
"msg": "success",
"data": {
"name": "项目文档 第1版",
"version": "fnJfyX",
"parent_token": "doxbcyvqZlSc9WlHvQMlSJabcef",
"owner_id": "694699009591869450",
"creator_id": "694699009591869451",
"create_time": "1660708537",
"update_time": "1660708537",
"status": "0",
"obj_type": "docx",
"parent_type": "docx"
}
}错误码
| HTTP状态码 | 错误码 | 描述 | 排查建议 |
|---|---|---|---|
| 403 | 1068400 | Has no permission, please apply the file permission of reading or edition. | 无阅读或编辑权限,请申请源文档的阅读或编辑权限。 |
| 404 | 1068404 | Parent file does not exist, please check the file status. | 源文档不存在,请检查文档是否已删除。 |
| 400 | 1068410 | Params error, param [file_token] is wrong. | file_token 请求参数错误,请检查参数。 |
| 400 | 1068411 | Params error, param [obj_type] is wrong. | obj_type 请求参数错误,请检查参数。 |
| 400 | 1068412 | Params error, param [version_id] is wrong. | version_id 请求参数错误,请检查参数。 |
| 400 | 1068425 | Request failed, please contact the engineer-https://applink.feishu.cn/TLJsX982. | 请求失败,请联系技术支持。 |
| 404 | 1068403 | File does not exist, please check the file status. | 文档版本不存在,请检查版本文档是否已被删除。 |
