CopyObject
Description
CopyObject is used to copy objects within the same bucket or between different buckets in the same region.
Request Method
POST
Request Path
/apsara/route/OneRouter/CopyObject
Request Parameters Common Parameters
Name | Location | Type | Required | Sample value | Description |
---|---|---|---|---|---|
x-oss-metadata-directive | BODY | string | No | COPY | specifies how to set the meta information of the target object. The values are as follows: COPY (default): Copy the metadata of the source Object to the target Object. OSS will not copy the of the source Object x-oss-server-side-encryption The property is configured to the target Object. The server-side encryption encoding method of the target object depends on whether is specified for the current copy operation. x-oss-server-side-encryption . REPLACE: Ignore the metadata of the source Object and directly use the metadata specified in the request. |
x-oss-server-side-encryption | BODY | string | No | AES256 | specifies the server-side entropy encoding encryption algorithm when OSS creates the target object. values: AES256 , KMS if the copy operation is not specified x-oss-server-side-encryption , no matter whether the source object has been encrypted or encoded on the server side, the copied target object will not be encrypted or encoded on the server side. If is specified in the copy operation x-oss-server-side-encryption , regardless of whether the source object has been encrypted or encoded on the server side, the copied target object will be encrypted and encoded on the server side. And the response header of the copy operation will contain x-oss-server-side-encryption , the value is the encryption algorithm of the target object. When the target object is downloaded, the response header also contains x-oss-server-side-encryption , the value is the encryption algorithm of the object. |
version | BODY | string | No | 2016-01-01 | version of api |
x-oss-copy-source | BODY | string | Yes | /oss-example/oss.jpg | specifies the source address of the copy. Default value: None |
x-oss-copy-source-if-unmodified-since | BODY | string | No | 2019-04-09T07:01:56.000Z | if the specified time is equal to or later than the actual modification time of the file, the file is copied normally and 200 OK is returned; Otherwise, the 412 Precondition Failed error code (preprocessing failed) is returned. Default value: None |
x-oss-tagging | BODY | string | No | a:1 | specifies the object label of the object. multiple labels can be set at the same time, for example: TagA = A & amp;TagB = B. indicates that Key and Value require advanced URL encoding. if an item does not have "=", Value is regarded as a null character. |
x-oss-object-acl | BODY | string | No | private | Specify the access permission when OSS creates the target object. Value: public-read, private, public-read-write, default. |
x-oss-tagging-directive | BODY | string | No | Copy | specifies how to set the object label of the target object. The values are as follows: Copy (default): Copy the object label of the source object to the target object. Replace: the object label of the source object is ignored, and the object label specified in the request is directly used. |
regionId | BODY | string | Yes | No sample value for this parameter. | region id |
x-oss-copy-source-if-none-match | BODY | string | No | 5B3C1A2E053D763E1B002CC607C5**** | if the ETag value of the source object is not equal to the ETag value you provided, the copy operation is performed and 200 OK is returned; Otherwise, the 304 Not Modified error code (preprocessing failed) is returned. Default value: None |
x-oss-copy-source-if-match | BODY | string | No | 5B3C1A2E053D763E1B002CC607C5**** | if the ETag value of the source object is equal to the ETag value provided by you, the copy operation is performed and 200 OK is returned; Otherwise, the 412 Precondition Failed error code (preprocessing failed) is returned. Default value: None |
x-oss-copy-source-if-modified-since | BODY | string | No | 2019-04-09T07:01:56.000Z | if the source object has been modified after the time specified by the user, the copy operation is performed; Otherwise, 304 Not Modified error code (preprocessing failed) is returned. Default value: None |
x-oss-server-side-encryption-key-id | BODY | string | No | 9468da86-3509-4f8d-a61e-6eab1eac**** | indicates the user master key hosted by KMS. This parameter is only available in x-oss-server-side-encryption is valid for KMS. |
Return data
Name | Type | Sample value | Description |
---|---|---|---|
LastModified | string | Fri, 24 Feb 2012 07:18:48 GMT | the last update time of the target object. parent element: CopyObjectResult |
ETag | string | 5B3C1A2E053D763E1B002CC607C5**** | the ETag value of the target object. parent element: CopyObjectResult |
CopyObjectResult | container | not involved | CopyObject result. Default value: None |
Example
Successful Response example
{
"LastModified":"Fri,
24 Feb 2012 07:18:48 GMT",
"ETag":"5B3C1A2E053D763E1B002CC607C5****",
"CopyObjectResult":"not involved"
}
Failed Response example
{
"errorSample":
{
"resultCode":-1,
"resultMsg":"system error",
"result":null
}
}