该接口用于发布智能文档。支持首次发布和再次发布(更新版本),发布时可同时设置可见范围。
⚠️ 此接口内部包含异步任务处理,耗时较长(通常 3-8 秒),建议调用方配置超时时间为 10 秒以上。
请求方式:POST(HTTPS)
请求地址:https://qyapi.weixin.qq.com/cgi-bin/wedoc/smartdoc/publish?access_token=ACCESS_TOKEN
请求包体
{
"docid": "DOCID",
"publish_range": 1,
"auth_list": [
{
"type": 1,
"userid": "USERID"
},
{
"type": 2,
"departmentid": 1
}
]
}
参数说明
| 参数 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| docid | string | 是 | 智能文档的文档 id,可通过 新建文档 接口创建 |
| publish_range | uint32 | 否 | 发布可见范围。1:企业内可见;3:企业内外可见;4:指定成员可见。不传时默认为1(企业内可见) |
| auth_list | obj[] | 条件必填 | 指定可见成员列表,publish_range为4时必填 |
| auth_list.type | uint32 | 是 | 成员类型。1:企业成员;2:部门 |
| auth_list.userid | string | 条件必填 | 企业成员的userid,type为1时必填 |
| auth_list.departmentid | uint64 | 条件必填 | 部门id,type为2时必填 |
权限说明
返回示例
{
"errcode": 0,
"errmsg": "ok",
"share_code": "SHARE_CODE",
"publish_url": "PUBLISH_URL",
"version": 1,
"publish_time": 1710000000,
"publish_doc_title": "PUBLISH_DOC_TITLE"
}
参数说明
| 参数 | 类型 | 说明 |
|---|---|---|
| errcode | int32 | 错误码 |
| errmsg | string | 错误码说明 |
| share_code | string | 分享码 |
| publish_url | string | 发布页访问链接,格式为 https://doc.weixin.qq.com/smartdoc/p/{share_code} |
| version | uint64 | 发布版本号 |
| publish_time | uint64 | 发布时间戳(秒) |
| publish_doc_title | string | 发布页标题 |
错误码说明
| 错误码 | 说明 |
|---|---|
| 640008 | 权限不足,调用者无管理权限 |
| 640012 | auth_list中userid无效,成员不在企业中 |
| 640013 | auth_list中departmentid无效 |
| 640017 | 企业未开启API功能,需管理员开启 |
| 640018 | 企业管理员未授予API编辑权限 |
| 640027 | 参数错误,如docid不合法、publish_range无效等 |
| 640032 | 被企业管理端权限限制 |
| 640054 | docid不是智能文档类型 |
