Skip to content

创建订阅

订阅文档中的变更事件,当前支持文档评论订阅,订阅后文档评论更新会有“云文档助手”推送给订阅的用户

请求

项目
HTTP URLhttps://open.feishu.cn/open-apis/drive/v1/files/:file_token/subscriptions
HTTP MethodPOST
接口频率限制100 次/分钟
支持的应用类型custom,isv
权限要求 调用该 API 所需的权限。开启其中任意一项权限即可调用 开启任一权限即可docs:document.subscription 订阅云文档和更新云文档订阅状态 drive:drive 查看、评论、编辑和管理云空间中所有文件 drive:drive:readonly 查看、评论和下载云空间中所有文件

请求头

名称类型必填描述
Authorizationstringuser_access_token 值格式:"Bearer access_token" 示例值:"Bearer u-7f1bcd13fc57d46bac21793a18e560" 了解更多:如何选择与获取 access token
Content-Typestring固定值:"application/json; charset=utf-8"

路径参数

名称类型描述
file_tokenstring文档token
示例值:"doxcnxxxxxxxxxxxxxxxxxxxxxx"

请求体

名称类型必填描述
subscription_idstring订阅关系ID
示例值:"1234567890987654321"
subscription_typestring订阅类型
示例值:"comment_update"
可选值有
- comment_update: 评论更新
is_subcribeboolean是否订阅
示例值:true
file_typestring文档类型
示例值:"doc"
可选值有
- doc: 文档 - docx: 新版文档 - wiki: 知识库wiki

请求体示例

json
{"subscription_type":"comment_update", "file_type":"docx"}

响应

响应体

名称类型描述
codeint错误码,非 0 表示失败
msgstring错误描述
data\--
  └ subscription_idstring订阅关系ID
  └ subscription_typestring订阅类型
可选值有
- comment_update: 评论更新
  └ is_subcribeboolean是否订阅
  └ file_typestring文档类型
可选值有
- doc: 旧版文档 - docx: 新版文档 - wiki: 知识库

响应体示例

json
{
    "code": 0,
    "data": {
        "file_type": "docx",
        "is_subcribe": true,
        "subscription_id": "xxxxxxx",
        "subscription_type": "comment_update"
    },
    "msg": "success"
}

错误码

HTTP状态码错误码描述排查建议
4001064000Illegal parameter检查参数有效性
4031064030Permission denied检查文档权限,订阅评论至少需要阅读的权限
4041064040Token not exist检查文档是否能正常访问
5001065000Internal Server Error重试,若稳定失败请联系相关业务方oncall人员

内容来源:飞书开放平台 · 自动爬取整理