Method | URI | Description |
---|---|---|
COPY | /v1/{account}/{container}/{object} | Copies an object to another object in the object store. |
You can copy an object to a new object with the same name. Copying to the same name is an alternative to using POST to add metadata to an object. With POST, you must specify all the metadata. With COPY, you can add additional metadata to the object.
Alternatively, you can use PUT with the
X-Copy-From
request header to
accomplish the same operation as the COPY object
operation.
The PUT operation always creates a new object. If
you use this operation on an existing object, you
replace the existing object and metadata rather than
modifying the object. Consequently, this operation
returns a 201 Created
success
node.
If you use this operation to copy a manifest object, the new object is a normal object and not a copy of the manifest. Instead it is a concatenation of all the segment objects. This means that you cannot copy objects larger than 5 GB in size. All metadata is preserved during the object copy. If you specify metadata on the request to copy the object, either PUT or COPY, the metadata overwrites any conflicting keys on the target (new) object.
Example requests and responses:
Copy the
goodbye
object from themarktwain
container to thejaneausten
container:curl -i $publicURL/marktwain/goodbye -X COPY -H "X-Auth-Token: $token" -H "Destination: janeausten/goodbye"
HTTP/1.1 201 Created Content-Length: 0 X-Copied-From-Last-Modified: Thu, 16 Jan 2014 21:19:45 GMT X-Copied-From: marktwain/goodbye Last-Modified: Fri, 17 Jan 2014 18:22:57 GMT Etag: 451e372e48e0f6b1114fa0724aa79fa1 Content-Type: text/html; charset=UTF-8 X-Object-Meta-Movie: AmericanPie X-Trans-Id: txdcb481ad49d24e9a81107-0052d97501 Date: Fri, 17 Jan 2014 18:22:57 GMT
Alternatively, you can use PUT to copy the
goodbye
object from themarktwain
container to thejaneausten
container. This request requires aContent-Length
header even if it is set to zero (0).curl -i $publicURL/janeausten/goodbye -X PUT -H "X-Auth-Token: $token" -H "X-Copy-From: /marktwain/goodbye" -H "Content-Length: 0"
HTTP/1.1 201 Created Content-Length: 0 X-Copied-From-Last-Modified: Thu, 16 Jan 2014 21:19:45 GMT X-Copied-From: marktwain/goodbye Last-Modified: Fri, 17 Jan 2014 18:22:57 GMT Etag: 451e372e48e0f6b1114fa0724aa79fa1 Content-Type: text/html; charset=UTF-8 X-Object-Meta-Movie: AmericanPie X-Trans-Id: txdcb481ad49d24e9a81107-0052d97501 Date: Fri, 17 Jan 2014 18:22:57 GMT
For a complete description of HTTP 1.1 header definitions, see Header Field Definitions.
Note | |
---|---|
When several replicas exist, the system copies
from the most recent replica. That is, the COPY
operation behaves as though the
|
Normal response codes: 201
This table shows the header parameters for the copy object request:
Name | Type | Description |
---|---|---|
| String (Optional) | Authentication token. If you omit this header, your request fails unless the account owner has granted you access through an access control list (ACL). |
| String (Required) | The container and object name of the destination
object in the form of |
| String (Optional) | Changes the MIME type for the object. |
| String (Optional) | If set, the value of the
|
| String (Optional) | If set, specifies the override behavior for the browser. For example, this header might specify that the browser use a download program to save this file rather than show the file, which is the default. |
| String (Optional) | The container metadata, where You must specify a |
This table shows the URI parameters for the copy object request:
Name | Type | Description |
---|---|---|
| String | The unique name for the account. An account is also known as the project or tenant. |
| String | The unique name for the container. |
| String | The unique name for the object. |
This table shows the header parameters for the copy object response:
Name | Type | Description |
---|---|---|
| String (Required) | If the operation succeeds, this value is zero (0). If the operation fails, this value is the length of the error text in the response body. |
| String (Optional) | For a copied object, shows the last modified date and time for the container and object name from which the new object was copied. |
| String (Optional) | For a copied object, shows the container and object name from which the new object was copied.
The value is in form |
| String (Required) | The date and time that the object was created or the last time that the metadata was changed. |
| String (Required) | The MD5 checksum of the copied object content. The value is not quoted. |
| String (Required) | The MIME type of the object. |
| String (Required) | The custom object metadata item, where
One |
| Uuid (Required) | A unique transaction identifier for this request. Your service provider might need this value if you report a problem. |
| Datetime (Required) | The transaction date and time. |