[This is prerelease documentation and is subject to change in future releases.]
The Copy Blob operation copies a blob to a destination within the storage account.
The Copy Blob request may be constructed as follows. Replace myaccount with the name of your storage account, mycontainer with the name of your container, and myblob with the name of your destination blob.
|
Method
|
Request URI
|
HTTP Version
|
|---|
PUT | http://myaccount.blob.core.windows.net/mycontainer/myblob | HTTP/1.1 |
Note |
|---|
|
The Copy Blob operation is available only in the 2009-04-14 version of the Blob service. It is currently available only in Windows® Azure™ storage services, and not in development storage, nor within the Storage Client sample included in the Windows Azure SDK. |
URI Parameters
Request Headers
The following table describes required and optional request headers.
|
Request Header
|
Description
|
|---|
Authorization | Required. Specifies the authentication scheme, account name, and signature. For more information, see Authentication Schemes. |
Date or x-ms-date | Required. Specifies the Coordinated Universal Time (UTC) for the request. For more information, see Authentication Schemes. |
x-ms-version | Required. Set this value to 2009-04-14. For more information, see Storage Service Versioning. |
x-ms-copy-source:name | Required. Specifies the name of the source blob, in the following format: /accountName/containerName/blobName |
x-ms-meta-name:value | Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the source blob metadata to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob. |
x-ms-source-if-modified-since | Optional. A DateTime value. Specify this conditional header to copy the blob only if the source blob has been modified since the specified date/time. If the source blob has not been modified, the Blob service returns status code 412 (Precondition Failed). |
x-ms-source-if-unmodified-since | Optional. A DateTime value. Specify this conditional header to copy the blob only if the source blob has not been modified since the specified date/time. If the source blob has been modified, the Blob service returns status code 412 (Precondition Failed). |
x-ms-source-if-match | Optional. An ETag value. Specify this conditional header to copy the source blob only if its ETag matches the value specified. If the ETag values do not match, the Blob service returns status code 412 (Precondition Failed). |
x-ms-source-if-none-match | Optional. An ETag value. Specify this conditional header to copy the blob only if its ETag does not match the value specified. If the values are identical, the Blob service returns status code 412 (Precondition Failed). |
If-Modified-Since | Optional. A DateTime value. Specify this conditional header to copy the blob only if the destination blob has been modified since the specified date/time. If the destination blob has not been modified, the Blob service returns status code 412 (Precondition Failed). |
If-Unmodified-Since | Optional. A DateTime value. Specify this conditional header to copy the blob only if the destination blob has not been modified since the specified date/time. If the destination blob has not been modified, the Blob service returns status code 412 (Precondition Failed). |
If-Match | Optional. An ETag value. Specify an ETag value for this conditional header to copy the blob only if the specified ETag value matches the ETag value for an existing destination blob. If the ETag for the destination blob does not match the ETag specified for If-Match, the Blob service returns status code 412 (Precondition Failed). |
If-None-Match | Optional. An ETag value, or the wildcard character (*). Specify an ETag value for this conditional header to copy the blob only if the specified ETag value does not match the ETag value for the destination blob. Specify the wildcard character (*) to perform the operation only if the destination blob does not exist. If the specified condition isn't met, the Blob service returns status code 412 (Precondition Failed). |
Request Body
The response includes an HTTP status code and a set of response headers.
Status Code
A successful operation returns status code 201 (Created).
For information about status codes, see Status and Error Codes.
Response Headers
The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.
|
Response header
|
Description
|
|---|
ETag | Returns the ETag for the destination blob. |
Last-Modified | Returns the date/time that the destination blob was last modified. |
x-ms-request-id | This header uniquely identifies the request that was made and can be used for troubleshooting the request. For more information, see Troubleshooting API Operations. |
Only the account owner may call this operation.
When a blob is copied, the following data fields are copied to the destination blob with the same values:
- Content-Type
- Content-Encoding
- Content-Language
- Content-Length
- x-ms-blob-content-md5
The source blob's committed block list is also copied to the destination blob. Any uncommitted blocks are not copied.
You can specify one or more new metadata values for the destination blob by specifying the x-ms-meta-name:value header on the request. If this header is not specified, the metadata associated with the source blob is copied to the destination blob.
When the source blob and destination blob are the same, Copy Blob removes any uncommitted blocks. If metadata is specified in this case, the existing metadata is overwritten with the new metadata.
You can specify conditional headers on the request to copy the blob only if a condition is met. If the specified condition is not met, the blob is not copied, and the Blob service returns status code 412 (Precondition Failed), along with additional error information that indicates whether the unmet condition was specified for the source blob or for the destination blob.
Note that copying a source blob always copies the entire blob; copying a range of bytes or a set of blocks is not supported.
Concepts
Authentication Schemes
Status and Error Codes
Blob Service Error Codes
Copyright © 2009 by Microsoft Corporation. All rights reserved.