Go to main content

Oracle® ZFS Storage Appliance Object API Guide for Amazon S3 Service Support, Release OS8.8.0

Exit Print View

Updated: January 2019
 
 

PUT Object Copy

The PUT Object Copy operation creates a copy of a stored S3 object. A PUT Object Copy operation is the same as performing a GET and then a PUT. Adding the request header, x-amz-copy-source, makes the PUT operation copy the source object into the destination bucket. When copying an object, you can preserve most of the metadata (default) or specify new metadata. However, the ACL is not preserved and is set to private for the user making the request. All copy requests must be authenticated and cannot contain a message body. Additionally, you must have READ access to the source object and WRITE access to the destination bucket. To copy an object only under certain conditions, such as whether the ETag matches or whether the object was modified before or after a specified date, use the request headers x-amz-copy-source-if-match, x-amz-copy-source-if-none-match, x-amz-copy-source-if-unmodified-since, or x-amz-copy-source-if-modified-since. For more details about using the PUT Object Copy operation, see the following:

Syntax Example

For a syntax example, see Amazon's official S3 PUT Object Copy API documentation (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectCOPY.html).

Versioning

By default, x-amz-copy-source identifies the current version of an object to copy. However, if the current version is a delete marker, S3 behaves as if the object were deleted.

To copy a different version, use the versionId subresource. If you enable versioning on the target bucket, S3 generates a unique version ID for the object being copied. This version ID is different from the version ID of the source object. S3 returns the version ID of the copied object in the x-amz-version-id response header in the response. Note that if you do not enable versioning or suspend versioning on the target bucket, the version ID S3 generates a null.

Access Permissions

To grant specific permission on an object using a request header, you can either:


Note -  You can use either a canned ACL or specify access permissions explicitly. You cannot do both.

Request Parameters

This implementation of PUT Object Copy operation does not support the use of request parameters.

Request Headers

The PUT Object Copy operation supports the use of following request headers:

Request Elements

The PUT Object Copy operation supports the following requests elements:

  • CopyObjectResult

  • ETag

  • LastModified

For a description of the supported request elements, see Amazon's official PUT Object Copy API documentation (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectCOPY.html).

Response Headers

The PUT Object Copy operation supports the use of the following response headers:

Response

This implementation of the PUT Object Copy operation does not return response elements.

Expected HTTP Response Code

200 OK

Error Response Code

The PUT Object Copy API does not return special errors. For general information about S3 errors and a list of error codes, see S3 Client Error Handling Reference.

Example

PUT /my-second-image.jpg HTTP/1.1
Host: bucket.s3.amazonaws.com
Date: Wed, 28 Oct 2018 22:32:00 GMT
x-amz-copy-source: /bucket/my-image.jpg
HTTP/1.1 200 OK
x-amz-request-id: tx318BC8BC148832E5
x-amz-copy-source-version-id: 0009
x-amz-version-id: 0099
Date: Wed, 28 Oct 2018 22:32:00 GMT
Connection: close
Server: Apache

<CopyObjectResult>
   <LastModified>2009-10-28T22:32:00</LastModified>
   <ETag>"9b2cf535f27731c974343645a3985328"</ETag>
 </CopyObjectResult>

Where x-amz-version-id returns the version ID of the object in the destination bucket, and x-amz-copy-source-version-id returns the version ID of the source object.