1.28.2 complete-multipart-upload

优质
小牛编辑
125浏览
2023-12-01

Complete multipart upload related api supported by FDS

Version: 1.0.0

/{bucketname}/{objectname}

PUT

Summary:

完成分片上传

Description:

组合各个分片为一个Object

Parameters
NameLocated inDescriptionRequiredSchema
bucketnamepathBucket名字Yesstring
objectnamepathObject名字Yesstring
Dateheader请求时间Yesstring
uploadIdquery初始化分片上传获取的uploadIdYesstring
expiresquery如果上传成功,返回的签名的过期时间戳(UTC),单位毫秒,默认30天Nostring
content-typeheaderobject的content-typeNostring
bodybody需要合并的分片列表Yes
Responses
CodeDescriptionSchema
200请求成功PutObjectResult

Models

PutObjectResult

NameTypeDescriptionRequired
bucketnamestring (int32)Bucket名字No
objectNamestringObject名字No
accessKeyIdstring签名用的accessKeyIdNo
signaturestring用来下载这个Object的签名No
expiresstrin签名失效时间戳(UTC),单位毫秒,默认有效时间30天No

UploadPartResult

NameTypeDescriptionRequired
partNumberinteger分片编号No
etagstring分片IDNo
partSizelong分片大小No

命令行示例

curl -v -X PUT 'http://cnbj0.fds.api.xiaomi.com/fds-demo/tests/test.txt?uploadId=26287b89-62d7-4527-99ec-41a8fd8794a5' -H 'content-type: application/octet-stream' -H 'date: Tue, 28 Feb 2017 02:50:54 GMT' -d '{"uploadPartResultList":[{"etag":"a0a64b39f67c9bb4d98556454541c2b7","partNumber":1,"partSize":10245760}, {"etag":"0d599f0ec05c3bda8c3b8a68c32a1b47","partNumber":2,"partSize":5}]}'
* Hostname was NOT found in DNS cache
*   Trying 111.206.200.99...
* Connected to cnbj0.fds.api.xiaomi.com (111.206.200.99) port 80 (#0)
> PUT /fds-demo/tests/test.txt?uploadId=26287b89-62d7-4527-99ec-41a8fd8794a5 HTTP/1.1
> User-Agent: curl/7.35.0
> Host: cnbj0.fds.api.xiaomi.com
> Accept: */*
> content-type: application/octet-stream
> date: Tue, 28 Feb 2017 02:50:54 GMT
> Content-Length: 178
> 
* upload completely sent off: 178 out of 178 bytes
< HTTP/1.1 200 OK
* Server Tengine is not blacklisted
< Server: Tengine
< Date: Tue, 28 Feb 2017 03:20:08 GMT
< Content-Type: application/json
< Content-Length: 152
< Connection: keep-alive
< Access-Control-Allow-Credentials: true
< Access-Control-Max-Age: 1728000
< Access-Control-Allow-Methods: GET, POST, PUT, HEAD, DELETE, OPTIONS
< Access-Control-Allow-Headers: DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,Content-MD5
< Access-Control-Expose-Headers: content-md5, upload-time, x-xiaomi-meta-content-length
< 
* Connection #0 to host cnbj0.fds.api.xiaomi.com left intact
{"accessKeyId":"515xxx01","bucketName":"fds-demo","expires":1490844007182,"objectName":"tests/test.txt","signature":"rLSehxxxxM="}
# 使用返回的accessKey和signature下载文件
curl -v -X GET 'http://cnbj0.fds.api.xiaomi.com/fds-demo/tests/test.txt?signature=rLSehxxxxM=&accessKeyId=515xxx01'
* Hostname was NOT found in DNS cache
*   Trying 111.206.200.99...
* Connected to cnbj0.fds.api.xiaomi.com (111.206.200.99) port 80 (#0)
> GET /fds-demo/tests/test.txt?signature=MTexxxAl4=&accessKeyId=541xxx045 HTTP/1.1
> User-Agent: curl/7.35.0
> Host: cnbj0.fds.api.xiaomi.com
> Accept: */*
> 
< HTTP/1.1 200 OK
* Server Tengine is not blacklisted
< Server: Tengine
< Date: Thu, 02 Mar 2017 06:20:51 GMT
< Content-Type: application/octet-stream
< Content-Length: 5
< Connection: keep-alive
< last-modified: Thu, 02 Mar 2017 06:18:29 GMT
< x-xiaomi-meta-acl: PUBLIC_READ
< content-md5: 0d599f0ec05c3bda8c3b8a68c32a1b47
< Cache-Control: max-age=86400
< Access-Control-Allow-Credentials: true
< Access-Control-Max-Age: 1728000
< Access-Control-Allow-Methods: GET, POST, PUT, HEAD, DELETE, OPTIONS
< Access-Control-Allow-Headers: DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,Content-MD5
< Access-Control-Expose-Headers: content-md5, upload-time, x-xiaomi-meta-content-length
< 
...
# 文件内容