If you only want to retrieve the metadata of an object (and not its content), you
use the HEAD
operation. By default, you get the metadata of the most
recent version. To retrieve the metadata of a specific object version, you specify
its version ID.
To retrieve the metadata of an object version
-
Set
versionId
to the ID of the version of the object whose metadata you want to retrieve. -
Send a
HEAD Object versionId
request.
Example — Retrieving the metadata of a versioned object
The following request retrieves the metadata of version
3HL4kqCxf3vjVBH40Nrjfkd
of my-image.jpg
.
HEAD /my-image.jpg?versionId=3HL4kqCxf3vjVBH40Nrjfkd HTTP/1.1
Host: bucket.s3.amazonaws.com
Date: Wed, 28 Oct 2009 22:32:00 GMT
Authorization: AWS AKIAIOSFODNN7EXAMPLE:0RQf4/cRonhpaBX5sCYVf1bNRuU=
The following shows a sample response.
HTTP/1.1 200 OK
x-amz-id-2: ef8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC143432E5
x-amz-version-id: 3HL4kqtJlcpXroDTDmjVBH40Nrjfkd
Date: Wed, 28 Oct 2009 22:32:00 GMT
Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT
ETag: "fba9dede5f27731c9771645a39863328"
Content-Length: 434234
Content-Type: text/plain
Connection: close
Server: AmazonS3