CDN加速

InitiateMultipartUpload

更新时间:2021-06-17 14:16:08

InitiateMultipartUpload

使用分块上传时,须先调用Initiate Multipart Upload接口创建任务,系统会给用户返回一个全局唯一的多段上传任务号uploadId,作为任务标识。后续用户可以根据这个标识发起相关的请求,如:上传段、合并段、列举段等。同一个对象可以同时存在多个多段上传任务;每个多段上传任务在初始化时可以附加消息头信息。

需要IAM wos:PutObject权限。

请求语法

POST /ObjectName?uploads HTTP/1.1
Host: Bucket.Endpoint
Date: date
Authorization: authorization

Cache-Control: CacheControl
Content-Disposition: ContentDisposition
Content-Encoding: ContentEncoding
Content-Language: ContentLanguage
Content-Length: ContentLength
Content-MD5: ContentMD5
Content-Type: ContentType
Expires: Expires

URI请求参数

请求头部

除使用公共请求头部,还支持

参数

描述

是否必填

Content-MD5原始数据的MD5,如果数据在传输过程中没有遭到破坏导致MD5不一致,会响应403 SignatureDoesNotMatch
x-wos-storage-class定文件的存储类型,Standard-标准存储、IA-低频存储、Archive-归档存储。默认同空间的存储类型
x-wos-meta-*客户自定义元数据,会在headObject、getObject时的头部原样返回

请求主体

响应语法

HTTP/1.1 status_code

x-wos-request-id: request id
Date: date
Content-Length: length
Connection: status

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <InitiateMultipartUploadResult xmlns="https://www.wangsu.com/document">
    <Bucket>BucketName</Bucket>
    <Key>ObjectName</Key>
    <UploadId>uploadID</UploadId>
</InitiateMultipartUploadResult>

响应头部

仅使用公共响应头部

响应元素

元素名称

描述

InitiateMultipartUploadResult

描述多段上传任务的容器
类型:XML
子节点:BucketKeyUploadId
父节点:空

Bucket

多段上传对象所在空间的空间名
类型:字符串
父节点:InitiateMultipartUploadResult

Key

多段上传对象的key
类型:字符串
父节点:InitiateMultipartUploadResult

UploadId

多段上传id,后面进行多段上传时,利用这个id指定多段上传任务
类型:字符串
父节点:InitiateMultipartUploadResult

特殊错误

Situation

Http Status

Error Code

Message

签名有带uploadsURL中没带uploads;或者URL有带uploads,签名中没带uploads

403 Foribidden

SignatureDoesNotMatch

The request signature we calculated does not match the signature

签名有带uploadsURL中的uploads非法(比如拼写错误);或者URL有带uploads,签名中uploads非法(比如拼写错误)

403 Foribidden

SignatureDoesNotMatch

The request signature we calculated does not match the signature you provided.

签名和URL均有带uploads,但是拼写错误不一致

403 Foribidden

SignatureDoesNotMatch

The request signature we calculated does not match the signature you provided.

示例

POST /objectkey?uploads HTTP/1.1

Host: bucket.s3-cn-east-1.wcsapi.com
Date: Mon, 1 Apr 2017 20:34:56 GMT
Authorization: WOS AKIAIOSFODNN7EXAMPLE:VGhpcyBtZXNzYWdlIHNpZ25lZGGieSRlbHZpbmc=


HTTP/1.1 200 OK

x-wos-request-id: 996c76696e6727732072657175657374
Date: Mon, 1 Apr 2017 20:34:56 GMT
Content-Length: 146
Connection: keep-alive

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <InitiateMultipartUploadResult xmlns="https://www.wangsu.com/document">
    <Bucket>bucket01</Bucket>
    <Key>objectkey</Key>
    <UploadId>DCD2FC98B4F70000013DF578ACA318E7</UploadId>
</InitiateMultipartUploadResult>