创建订阅
订阅文档中的变更事件,当前支持文档评论订阅,订阅后文档评论更新会有“云文档助手”推送给订阅的用户
请求
| 项目 | 值 |
|---|---|
| HTTP URL | https://open.feishu.cn/open-apis/drive/v1/files/:file_token/subscriptions |
| HTTP Method | POST |
| 接口频率限制 | 100 次/分钟 |
| 支持的应用类型 | custom,isv |
| 权限要求 调用该 API 所需的权限。开启其中任意一项权限即可调用 开启任一权限即可 | docs:document.subscription 订阅云文档和更新云文档订阅状态 drive:drive 查看、评论、编辑和管理云空间中所有文件 drive:drive:readonly 查看、评论和下载云空间中所有文件 |
请求头
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| Authorization | string | 是 | user_access_token 值格式:"Bearer access_token" 示例值:"Bearer u-7f1bcd13fc57d46bac21793a18e560" 了解更多:如何选择与获取 access token |
| Content-Type | string | 是 | 固定值:"application/json; charset=utf-8" |
路径参数
| 名称 | 类型 | 描述 |
|---|---|---|
file_token | string | 文档token 示例值:"doxcnxxxxxxxxxxxxxxxxxxxxxx" |
请求体
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
subscription_id | string | 否 | 订阅关系ID 示例值:"1234567890987654321" |
subscription_type | string | 是 | 订阅类型 示例值:"comment_update" 可选值有: - comment_update: 评论更新 |
is_subcribe | boolean | 否 | 是否订阅 示例值:true |
file_type | string | 是 | 文档类型 示例值:"doc" 可选值有: - doc: 文档 - docx: 新版文档 - wiki: 知识库wiki |
请求体示例
json
{"subscription_type":"comment_update", "file_type":"docx"}响应
响应体
| 名称 | 类型 | 描述 |
|---|---|---|
code | int | 错误码,非 0 表示失败 |
msg | string | 错误描述 |
data | \- | - |
└ subscription_id | string | 订阅关系ID |
└ subscription_type | string | 订阅类型 可选值有: - comment_update: 评论更新 |
└ is_subcribe | boolean | 是否订阅 |
└ file_type | string | 文档类型 可选值有: - doc: 旧版文档 - docx: 新版文档 - wiki: 知识库 |
响应体示例
json
{
"code": 0,
"data": {
"file_type": "docx",
"is_subcribe": true,
"subscription_id": "xxxxxxx",
"subscription_type": "comment_update"
},
"msg": "success"
}错误码
| HTTP状态码 | 错误码 | 描述 | 排查建议 |
|---|---|---|---|
| 400 | 1064000 | Illegal parameter | 检查参数有效性 |
| 403 | 1064030 | Permission denied | 检查文档权限,订阅评论至少需要阅读的权限 |
| 404 | 1064040 | Token not exist | 检查文档是否能正常访问 |
| 500 | 1065000 | Internal Server Error | 重试,若稳定失败请联系相关业务方oncall人员 |
