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
Name | Located in | Description | Required | Schema |
---|---|---|---|---|
bucketname | path | Bucket名字 | Yes | string |
objectname | path | Object名字 | Yes | string |
Date | header | 请求时间 | Yes | string |
uploadId | query | 初始化分片上传获取的uploadId | Yes | string |
expires | query | 如果上传成功,返回的签名的过期时间戳(UTC),单位毫秒,默认30天 | No | string |
content-type | header | object的content-type | No | string |
body | body | 需要合并的分片列表 | Yes |
Responses
Code | Description | Schema |
---|---|---|
200 | 请求成功 | PutObjectResult |
Models
PutObjectResult
Name | Type | Description | Required |
---|---|---|---|
bucketname | string (int32) | Bucket名字 | No |
objectName | string | Object名字 | No |
accessKeyId | string | 签名用的accessKeyId | No |
signature | string | 用来下载这个Object的签名 | No |
expires | strin | 签名失效时间戳(UTC),单位毫秒,默认有效时间30天 | No |
UploadPartResult
Name | Type | Description | Required |
---|---|---|---|
partNumber | integer | 分片编号 | No |
etag | string | 分片ID | No |
partSize | long | 分片大小 | 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
<
...
# 文件内容