The HEAD operation is used to retrieve information about a specific object or object size, without actually fetching the object itself. This is useful if you're only interested in the object metadata, and don't want to waste bandwidth on the object data. A HEAD request has the same options as a GET operation on an object. The response is identical to the GET response, except that there is no response body.
For more information, see GET Object.
HEAD /destinationObjectHTTP/1.1 Host:destinationBucket.s3.amazonaws.com Authorization:signatureDate:date
This operation uses standard request headers.
HTTP/1.1 200 OK x-amz-id-2: id x-amz-request-id: request_id Date: date Last-Modified: date ETag: "etag" Content-Type: type Content-Length: length Connection: close Server: AmazonS3
| Name | Description |
|---|---|
Etag
|
Returns the Etag of the new object. Type: String Ancestor: None |
Content-Length
|
Returns the size of the object. Type: String Ancestor: None |
Content-Type
|
Returns the object type. Type: String Ancestor: None |
If the copy was not successful, you receive an error XML document.
There are no special errors for this operation. For information about general Amazon S3 errors, see List of Error Codes.
This example retrieves metadata for the Nelson object from the quotes bucket.
HEAD /Nelson HTTP/1.0 Host: quotes.s3.amazonaws.com Date: Wed, 01 Mar 2006 12:00:00 GMT Authorization: AWS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXAMPLE=
HTTP/1.1 200 OK x-amz-id-2: KZ7XUBI18rqFH91yZmYpWSRPg0/aeqwJXVzNgnk9Pa9GcHUuN2cxfsKk7V3NSUKg x-amz-request-id: F7B5DF3AB381F03F Date: Wed, 01 Mar 2006 12:00:00 GMT x-amz-meta-family: Muntz Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT ETag: "828ef3fdfa96f00ad9f27c383fc9ac7f" Content-Type: text/plain Content-Length: 5 Connection: close Server: AmazonS3