Files
MeBox/115doc/115开放平台/API列表/文件管理/文件上传/断点续传.md
T
2026-09-05 14:32:58 +08:00

111 lines
3.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 断点续传
### 基本信息
| 属性 | 内容 |
|:---------|:------------------------------|
| 接口名称 | 断点续传 |
| 接口版本 | v1.0 |
| 接口路径 | /upload/resume |
| 请求方法 | POST |
| 接口状态 | 生产环境 |
### 接口说明
根据已有上传任务和待上传文件信息,获取断点续传所需的对象存储上传参数。
### 接口地址
```
https://proapi.115.com/open/upload/resume
```
### 请求方式
```
POST
Content-Type: multipart/form-data
```
### 认证方式
```
Authorization: Bearer access_token
```
### 请求参数
| 参数名 | 类型 | 必填 | 默认值 | 说明 | 约束/示例 |
|:----------|:-----|:---|:----|:------------------|:--------------------|
| file_size | int | 是 | - | 文件大小,单位为字节 | 5335 |
| target | string | 是 | - | 文件上传目标 | `U_1_0`,格式为 `U_1_<文件夹ID>` |
| fileid | string | 是 | - | 文件 SHA1 值 | `<FILE_SHA1>` |
| pick_code | string | 是 | - | 上传任务唯一标识 | `<PICK_CODE>` |
### 请求示例
```shell
curl 'https://proapi.115.com/open/upload/resume' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
-F 'file_size=5335' \
-F 'target=U_1_0' \
-F 'fileid=<FILE_SHA1>' \
-F 'pick_code=<PICK_CODE>'
```
### 响应字段说明
| 字段 | 类型 | 描述 |
|:--------------------------|:------|:----------------------|
| state | boolean | 状态码,是表示成功,否表示异常 |
| message | string | 异常信息 |
| code | int | 异常码 |
| data | object | 续传调度数据 |
| data.version | string | 上传接口版本 |
| data.target | string | 文件上传目标 |
| data.pick_code | string | 上传任务唯一标识 |
| data.bucket | string | 对象存储 bucket |
| data.object | string | OSS 对象标识 |
| data.callback | object | 上传完成回调数据 |
| data.callback.callback | string | 上传完成回调信息 |
| data.callback.callback_var | string | 上传完成回调参数 |
### 响应示例
```json
{
"state": true,
"message": "",
"code": 0,
"data": {
"version": "",
"target": "U_1_0",
"pick_code": "",
"bucket": "",
"object": "",
"callback": {
"callback": "",
"callback_var": ""
}
}
}
```
### 业务规则
- `target` 必须匹配 `U_1_<数字文件夹ID>`;`U_1_0` 表示网盘根目录。
- 非 VIP 用户单文件大小不得超过 5 GiB;尝鲜VIP、体验VIP用户单文件大小不得超过 15 GiB。
- 续传前会检查用户剩余空间和盗播上传封禁状态。
- 上游调度结果的 `status` 只有为 1 或 2 时才按成功响应返回续传参数。
### 注意事项
- `pick_code` 必须来自原上传初始化调度响应,并与当前文件信息匹配。
- 请妥善保管 `access_token`、上传凭证与回调数据,不要在日志或客户端可见信息中输出。
### 修改历史
| 修改时间 | 修改说明 |
|:-----------------------------|:-----|
| 2025年04月01日(周二) 00:00:00 | 创建文档 |