1.28.13 copy-object

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

Copy object related api supported by FDS

Version: 1.0.0

/{dst_bucketname}/{dst_objectname}

PUT

Summary:

将一个src_objectname从src_bucketname复制到dst_bucketname,并重命名为dst_objectname

Description:

只有具有有源Object读权限和目标Object位置写权限的key才可以执行操作

Parameters
NameLocated inDescriptionRequiredSchema
dst_bucketnamepath目标bucket名字Yesstring
dst_objectnamepath目标object名字Yesstring
cpquery标识此请求为copy请求,可以为空Yesstring
authorizationheader认证信息,计算方式参考签名认证相关文档Yesstring
Dateheader请求时间Yesstring
bodybody源Bucket名和源Object名YesCopyObjectBean
Responses
CodeDescription
200请求成功
409已经存在同名的Bucket

Models

CopyObjectBean

NameTypeDescriptionRequired
srcBucketNamestring源Bucket名字No
srcObjectNamestring源Object名字No

命令行示例

# Copy object hello/world.txt to dst_bucketname/dst_objectname.txt
curl -v -X 'PUT' 'http://cnbj0.fds.api.xiaomi.com/dst_bucketname/dst_objectname.txt?cp' \
> -H 'content-type: application/json' \
> -H 'authorization: Galaxy-V2 541xxx45:LepxxxmQ=' \
> -H 'date: Mon, 27 Feb 2017 09:40:11 GMT' \
> -d '{"srcBucketName":"hello","srcObjectName":"world.txt"}'
*   Trying 10.142.10.45...
* TCP_NODELAY set
* Connected to cnbj0-fds.api.xiaomi.net (10.142.10.45) port 80 (#0)
> PUT /dst_bucketname/dst_objectname.txt?cp HTTP/1.1
> Host: cnbj0-fds.api.xiaomi.net
> User-Agent: curl/7.58.0
> Accept: */*
> content-type: application/json
> authorization: Galaxy-V2 541xxx45:LepxxxmQ=
> date: Mon, 27 Feb 2017 09:40:11 GMT
> Content-Length: 53
> 
* upload completely sent off: 53 out of 53 bytes
< HTTP/1.1 200 OK
< Server: Tengine
< Date: Mon, 15 Jul 2019 02:26:51 GMT
< Content-Length: 147
< Connection: keep-alive
< Access-Control-Allow-Origin: *
< 
* Connection #0 to host cnbj0.fds.api.xiaomi.com left intact
{"accessKeyId":"54xxx45","bucketName":"dst_bucketname","expires":1490780472318,"objectName":"dst_objectname.txt","signature":"6WxxxQ="}