1.28.30 upload-part

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

Upload part related api supported by FDS

Version: 1.0.0

/{bucketname}/{objectname}

PUT

Summary:

上传一个分片

Description:

必须先通过初始化接口获取一个合法的uploadId

Parameters
NameLocated inDescriptionRequiredSchema
bucketnamepathBucket名字Yesstring
objectnamepath上传的Object名字Yesstring
uploadIdquery初始化分片上传后获取的uploadIdYesstring
partNumberquery分片编号Yesstring
authorizationheader认证信息,计算方式参考签名认证相关文档Nostring
Dateheader请求时间Yesstring
bodybody分片内容Yesbinary
Responses
CodeDescriptionSchema
200请求成功UploadPartResult

Models

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&partNumber=1' \
 -H 'content-type: application/octet-stream' \
 -H 'date: Tue, 28 Feb 2017 02:50:54 GMT' \
 --data-binary @./part1
> PUT /fds-demo/tests/test.txt?uploadId=26287b89-62d7-4527-99ec-41a8fd8794a5&partNumber=1 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: 10245760
> Expect: 100-continue
> 
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
* Server Tengine is not blacklisted
< Server: Tengine
< Date: Tue, 28 Feb 2017 03:18:40 GMT
< Content-Type: application/json
< Content-Length: 78
< 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
{"etag":"a0a64b39f67c9bb4d98556454541c2b7","partNumber":1,"partSize":10245760}
# 上传第二个分片
curl -v -X PUT 'http://cnbj0.fds.api.xiaomi.com/fds-demo/tests/test.txt?uploadId=26287b89-62d7-4527-99ec-41a8fd8794a5&partNumber=2' \
 -H 'content-type: application/octet-stream' \
 -H 'date: Tue, 28 Feb 2017 02:50:54 GMT' \
 --data-binary @./part2
> PUT /fds-demo/tests/test.txt?uploadId=26287b89-62d7-4527-99ec-41a8fd8794a5&partNumber=2 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: 5
> 
* upload completely sent off: 5 out of 5 bytes
< HTTP/1.1 200 OK
* Server Tengine is not blacklisted
< Server: Tengine
< Date: Tue, 28 Feb 2017 03:05:11 GMT
< Content-Type: application/json
< Content-Length: 71
< 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
{"etag":"0d599f0ec05c3bda8c3b8a68c32a1b47","partNumber":2,"partSize":5}