FDS Restful API

Upload part related api supported by FDS

Version: 1.0.0

/{bucketname}/{objectname}

PUT

Summary:

上传一个分片

Description:

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

Parameters
Name Located in Description Required Schema
bucketname path Bucket名字 Yes string
objectname path 上传的Object名字 Yes string
uploadId query 初始化分片上传后获取的uploadId Yes string
partNumber query 分片编号 Yes string
authorization header 认证信息,计算方式参考签名认证相关文档 No string
Date header 请求时间 Yes string
body body 分片内容 Yes binary
Responses
Code Description Schema
200 请求成功 UploadPartResult

Models

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&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}

results matching ""

    No results matching ""