PutObject (Copy)

Prev Next

Available in Classic and VPC

Create a copy of the object based on the specified headers. No request query parameter or request body is used in the operation.

Note
  • Unless you make changes to the copy, the metadata in the copy remains the same as the original. However, the ACL settings applied to the account that the copy is created on are reset to private.

Requests

The following describes the request format for the endpoint. The request format is as follows.

Method URI
PUT /{bucket-name}/{object-name}

Request syntax

The request syntax is as follows.

PUT https://{endpoint}/{bucket-name}/{object-name} # path style
PUT https://{bucket-name}.{endpoint}/{object-name} # virtual host style

Request headers

The following describes the PutObject (Copy) header. For headers common to all Object Storage APIs, see Object Storage common request headers.

Field Type Required Description
x-amz-metadata-directive String Optional Set up to change original metadata
  • COPY | REPLACE
    • Overwrite the original metadata with the new metadata provided when entering REPLACE
x-amz-copy-source-if-match String Optional Create a copy if the specified ETag string matches the source object
x-amz-copy-source-if-none-match String Optional Create a copy if the specified ETag string is different from the source object
x-amz-copy-source-if-unmodified-since String Optional Create a copy if the source object hasn't been edited since the specified date
  • Must be in a valid date format
    • <Example> Wed, 30 Nov 2016 20:21:38 GMT
x-amz-copy-source-if-modified-since String Optional Create a copy if the source object has been edited since the specified date
  • Must be in a valid date format
    • <Example> Wed, 30 Nov 2016 20:21:38 GMT

Request path parameters

The following describes the parameters.

Field Type Required Description
bucket-name String Required Name of the bucket to create a copy of the object in
object-name String Required Name of the object to copy

Request example

The following is a sample request.

PUT /example-bucket/wild-bee HTTP/1.1
Authorization: {authorization-string}
x-amz-date: 20161130T195251Z
x-amz-copy-source: /garden/bee
Host: kr.object.ncloudstorage.com

Responses

The following describes the response format.

Response headers

For response headers common to all Object Storage APIs, see Object Storage common response headers.

Response status codes

For response status codes common to all Object Storage APIs, see Object Storage response status codes.

Response example

The following is a sample response.

HTTP/1.1 200 OK
Date: Wed, 30 Nov 2016 19:52:52 GMT
Accept-Ranges: bytes
x-amz-request-id: 72992a90-8f86-433f-b1a4-7b1b33714bed
ETag: "853aab195ce770b0dfb294a4e9467e62"
Content-Type: application/xml
Content-Length: 240
<CopyObjectResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
  <LastModified>2016-11-30T19:52:53.125Z</LastModified>
  <ETag>"853aab195ce770b0dfb294a4e9467e62"</ETag>
</CopyObjectResult>