Skip to content

分片上传素材-上传分片

根据 预上传接口返回的上传事务 ID 和分片策略上传对应的素材分片。上传完成后,你可调用 分片上传素材(完成上传)触发完成上传。

使用限制

该接口调用频率上限为 5 QPS,10000 次/天。

请求

项目
HTTP URLhttps://open.feishu.cn/open-apis/drive/v1/medias/upload_part
HTTP MethodPOST
接口频率限制特殊频控
支持的应用类型custom,isv
权限要求 调用该 API 所需的权限。开启其中任意一项权限即可调用 开启任一权限即可bitable:app 查看、评论、编辑和管理多维表格 docs:doc 查看、评论、编辑和管理文档 docs:document.media:upload 上传图片和附件到云文档中 drive:drive 查看、评论、编辑和管理云空间中所有文件 sheets:spreadsheet 查看、评论、编辑和管理电子表格

请求头

名称类型必填描述
Authorizationstringtenant_access_tokenuser_access_token 值格式:"Bearer access_token" 示例值:"Bearer u-7f1bcd13fc57d46bac21793a18e560" 了解更多:如何选择与获取 access token
Content-Typestring示例值:"multipart/form-data; boundary=---7MA4YWxkTrZu0gW"

Note 更多云文档接口权限问题,参考常见问题

请求体

名称类型必填描述
upload_idstring分片上传事务的 ID。通过调用分片上传素材(预上传)接口获取。
示例值:"7111211691345512356"
seqint块号,从 0 开始计数。
示例值:0
sizeint块的大小,单位为字节。
示例值:4194304
checksumstring素材文件的 Adler-32 校验和
示例值:"3248270248"
filefile素材文件分片的二进制内容
示例值:file binary

请求体示例

HTTP
---7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="upload_id";

7111211691345512356
---7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="seq";

0
---7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="size";

4194304
---7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="checksum";

3248270248
---7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file";
Content-Type: application/octet-stream

file binary
---7MA4YWxkTrZu0gW

响应

响应体

名称类型描述
codeint错误码,非 0 表示失败
msgstring错误描述
data\--

响应体示例

json
{
    "code": 0,
    "msg": "success",
    "data": {}
}

错误码

HTTP状态码错误码描述排查建议
2001061001internal error.服务内部错误,包括超时,错误码没处理。
4001061002params error.请检查请求参数是否正确。
4041061003not found.请确认对应资源是否存在。
4031061004forbidden.请确认当前身份是否有对应上传节点的的权限,如用户是否有上传到指定doc的编辑权限。
4011061005auth failed.请使用正确身份访问该接口。
2001061006internal time out.服务内部超时,可稍后再试。
4041061007file has been delete.请确认对应节点未被删除。
4001061008invalid file name.请检查文件名,当前文件名过长或者为空。
4001061021upload id expire.上传事务过期,请重头开始上传。
4001061041parent node has been deleted.请确认上传点未被删除。
4001061042parent node out of limit.在当前上传点上传过多素材,请更换上传点。
4001061043file size beyond limit.请检查文件长度以避免超出限制。具体限制请参考飞书帮助中心
4001061044parent node not exist.请确认上传点是否存在。
2001061045can retry.内部可重试错误,请稍后重试。
4001061109file name cqc not passed.请确保上传的文件和文件名合规。
4001061113file cqc not passed.请确保上传的文件和文件名合规。
4001061101file quota exceeded.租户容量超限,请确保租户有足够容量进行上传。
2021062004cover generating.缩略图正在生成中,请稍后再试。
2021062005file type not support cover.此文件类型不支持生成缩略图。
2021062006cover no exist.缩略图正在生成中,请稍后再试。
4001062007upload user not match.请确保当前请求身份和上传任务的身份为同一个。
4001062008checksum param Invalid.请确保文件/文件块的checksum正确。
4001062009the actual size is inconsistent with the parameter declaration size.实际传输的文件大小和参数说明的大小不符合一致。
4001062010block missing, please upload all blocks.部分文件分片缺失,请确保所有文件分片上传完成。
4001062011block num out of bounds.上传过多文件分片,请确保上传的为对应文件。
4001061547attachment parent-child relation number exceed.特指上传到文档的素材超出限制。
4001061061user quota exceeded.个人容量超限,请确保个人有足够容量进行上传。
4031061073no scope auth.没有申请接口权限。
4001062012file copying.文件正在拷贝中。
4001062013file damaged.文件拷贝失败。
4031062014dedupe no support.不允许秒传。
4001062051client connect close.客户端断开连接。
4001062505parent node out of size.云空间中所有层级的节点总和超限。上限为 40 万个,请检查节点数量。了解更多,参考云空间概述
4001062506parent node out of depth.云空间目录深度超限制(15限制)。
4001062507parent node out of sibling num.云空间中根目录或文件夹的单层节点超限。上限为 1500 个,你可通过将文件新建到不同文件夹中解决。

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