添加协作成员

... 2022-7-14 大约 2 分钟

# 添加协作成员

# 接口说明

本接口用于为文档添加协作成员。

# 权限说明

本接口需要拥有以下任意一项权限:

  • scope.drive.file.permission

# 请求格式

描述 定义
Path /openapi/drive/v2/files/{fileID}/collaborators
Method PATCH
Content-Type application/json
Accept application/json

# 请求头部

详见Headers

# 请求参数

# 路径参数

参数名 类型 必选 描述
fileID string 文档唯一标识,详见fileID

# 查询参数

# 请求体

参数名 类型 必选 描述
collaborators array 协作者列表
collaborators[].type string 固定填写 user
collaborators[].role string 协作成员身份
reader:浏览者
writer:编辑者
collaborators[].id string 协作者的 openID

# 响应参数

# 请求体

参数名 类型 描述
ret integer 业务返回码
msg string 业务返回码描述

# 请求包体

PATCH /openapi/drive/v2/files/300000000$AAAAAAAAAAAA/collaborators HTTP/1.1
Host: docs.qq.com
Access-Token: ACCESS_TOKEN
Client-Id: CLIENT_ID
Open-Id: OPEN_ID
Content-Type: application/json
Content-Length: 1

{'collaborators': [{'type': 'user', 'role': 'reader', 'id': 'AAAA'}, {'type': 'user', 'role': 'writer', 'id': 'BBBB'}]}
1
2
3
4
5
6
7
8
9
1
2
3
4
5
6
7
8
9

# 示例

curl --location --request PATCH 'https://docs.qq.com/openapi/drive/v2/files/300000000$AAAAAAAAAAAA/collaborators' \
--header 'Access-Token: ACCESS_TOKEN' \
--header 'Client-Id: CLIENT_ID' \
--header 'Open-Id: OPEN_ID' \
--header 'Content-Type: application/json' \
--data-raw '{
    "collaborators":[
        {"type": "user", "role": "reader", "id": "AAAA"},
        {"type": "user", "role": "writer", "id": "BBBB"}
    ]
}'
1
2
3
4
5
6
7
8
9
10
11
1
2
3
4
5
6
7
8
9
10
11

# 响应包体

HTTP/1.1 200 OK
Date: Thu, 28 Jul 2022 15:34:46 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 2
Connection: keep-alive
 
{'ret': 0, 'msg': 'Succeed'}
1
2
3
4
5
6
7
1
2
3
4
5
6
7

# 错误码

错误码 错误说明 排查建议
10313 Access-Token 为空 HTTP Header 里 Access-Token 校验失败,请参考示例中的携带方式,检查相应字段。详情请见Headers
10303 Open-Id 错误 HTTP Header 里 Open-Id 与预期不符,可能的原因有:
- Open-Id 为空。请参考示例中的携带方式,检查相应字段。详情请见Headers
- Open-IdAccess-Token 不匹配,请检查 Header 内容和获取 Token 接口回包是否一致。
10302 Client-Id 错误 HTTP Header 里 Client-Id 与预期不符,可能的原因有:
- Client-Id 为空。请参考示例中的携带方式,检查相应字段。详情请见Headers
- Client-IdAccess-Token 不匹配,请检查 Header 内容和调用获取 Token 接口接口时参数中的 Client-Id 是否一致。
37019 Token 校验失败,错误或过期 检查位于 HTTP Header 中的 Access-Token 是否正确,获取 Token 的方式请查阅授权流程以及获取 Token 接口

查询更多业务返回码

上次编辑于: 2023年5月31日 11:27
贡献者: mylochen , muyanyang , livlin