Copy Object
Creates a copy of an object in the storage server. You must have read access to the source object and write access to the destination bucket. If bucket is versioning enabled, then Copy Object API returns the VersionId of the object. When copying an object, both the metadata and the ACLs are not preserved.
Request Syntax
PUT /bucket/Key HTTP/1.1 Host: msdps3.server:8443 x-amz-copy-source: CopySource x-amz-object-lock-mode: ObjectLockMode x-amz-object-lock-retain-until-date: ObjectLockRetainUntilDate
Request Parameters
Bucket
The name of the destination bucket.
Required: Yes
Type: String
Key
The key of destination object.
Required: Yes
Type: String
x-amz-copy-source
Specifies the source object for the copy operation.
The value format: Specify the name of the source bucket and the key of the source object, separated by a slash (/).
For example, to copy the object
msdps3/copyright.txtfrom the bucket srcbk, use srcbk/msdps3/copyright.txt. The value must be URL-encoded.To copy a specific version of an object, append ?versionId=<version-id> to the value. For example, srcbk/msdps3/copyright.txt?versionId=AAAA1234567890
If you don't specify a version ID, the latest version of the source object is copied.
Pattern: \/.+\/.+
Required: Yes
x-amz-object-lock-mode (Flex WORM only)
The Object Lock mode that you want to apply to this copied object.
Valid Values: GOVERNANCE, COMPLIANCE
x-amz-object-lock-retain-until-date (Flex WORM only)
The date and time when you want this copied object's Object Lock to expire. It must be formatted as a timestamp parameter.
Response Syntax
HTTP/1.1 200 x-amz-copy-source-version-id: CopySourceVersionId x-amz-version-id: VersionId <?xml version="1.0" encoding="UTF-8"?> <CopyObjectResult> <ETag>string</ETag> <LastModified>timestamp</LastModified> </CopyObjectResult>
Response Headers
x-amz-copy-source-version-id
Version of the copied object in the source bucket.
x-amz-version-id
Version ID of the newly created copy.
ETag
Returns the ETag of the new object.
Type: String
LastModified
Creation date of the object.
Type: Timestamp
Possible Error Response
Success
HTTP status code 200.
EntityTooLarge
The object size exceeded maximum allowed size.
HTTP status code 400.
AccessDenied
Request was rejected because user authentication failed.
HTTP status code 403.
NoSuchBucket
The specified bucket does not exist.
HTTP status code 404.
InternalError
Request failed because of an internal server error.
HTTP status code 500.
InvalidRequest
The error may occur for some reasons. For details, please refer the error messages.
HTTP status code 400.