GET Object
Description
This implementation of the GET
operation retrieves objects from Amazon
S3. To use GET
, you must have READ
access to the object. If
READ
access is granted to the anonymous user, you can return the object
without using an authorization header.
If the latest version is a Delete Marker, Amazon S3 behaves as if the object was
deleted and Amazon S3 includes in the response: x-amz-delete-marker:
true
.
To distribute large files to many people, you can save bandwidth costs using BitTorrent. For more information, see
Versioning
By default, the GET
operation returns the latest version of an
object. To return a different version, use the versionId
sub-resource.
For more information about versioning, see PUT Bucket versioning. To see sample requests that use versioning, see Sample Request Getting a Specified Version of an Object.
Requests
Syntax
GET /ObjectName
HTTP/1.1 Host:BucketName
.s3.amazonaws.com Date:date
Authorization:signatureValue
Range:bytes=byte_range
Request Parameters
This implementation of the operation does not use request parameters.
Request Headers
This implementation of the operation can use the following request headers in addition to the request headers common to all operations. For more information, see Common Request Headers.
Name | Description | Required |
---|---|---|
Range
|
Downloads the specified range of an object. Type: String Default: None Constraints: None |
No |
If-Modified-Since
|
Return the object only if it has been modified since the specified time, otherwise return a 304 (not modified). Type: String Default: None Constraints: None |
No |
If-Unmodified-Since
|
Return the object only if it has not been modified since the specified time, otherwise return a 412 (precondition failed). Type: String Default: None Constraints: None |
No |
If-Match
|
Return the object only if its entity tag ( Type: String Default: None Constraints: None |
No |
If-None-Match
|
Return the object only if its entity tag ( Type: String Default: None Constraints: None |
No |
Request Elements
This implementation of the operation does not use request elements.
Responses
Response Headers
Header | Description |
---|---|
x-amz-delete-marker |
Specifies whether the object retrieved was ( Type: Boolean Valid Values: Default: |
x-amz-version-id |
Returns the version ID of the retrieved object if it has a unique version ID. Type: String Default: None |
Response Elements
This implementation of the operation does not return response elements.
Special Errors
This implementation of the operation does not return special errors. For general information about Amazon S3 errors and a list of error codes, see Error Responses.
Examples
Sample Request
The following request returns the object, my-image.jpg
.
GET /my-image.jpg HTTP/1.1 Host: bucket.s3.amazonaws.com Date: Wed, 28 Oct 2009 22:32:00 GMT Authorization: AWS 02236Q3V0WHVSRW0EXG2:0RQf4/cRonhpaBX5sCYVf1bNRuU=
Sample Response
HTTP/1.1 200 OK x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran x-amz-request-id: 318BC8BC148832E5 Date: Wed, 28 Oct 2009 22:32:00 GMT Last-Modified: Wed, 12 Oct 2009 17:50:00 GMT ETag: "fba9dede5f27731c9771645a39863328" Content-Length: 434234 Content-Type: text/plain Connection: close Server: AmazonS3 [434234 bytes of object data]
Sample Response if Latest Object is a Delete Marker
HTTP/1.1 404 Not Found x-amz-request-id: 318BC8BC148832E5 x-amz-id-2: eftixk72aD6Ap51Tnqzj7UDNEHGran x-amz-version-id: 3GL4kqtJlcpXroDTDm3vjVBH40Nr8X8g x-amz-delete-marker: true Date: Wed, 28 Oct 2009 22:32:00 GMT Content-Type: text/plain Connection: close Server: AmazonS3
Notice that the delete marker returns a 404 Not Found error.
Sample Request Getting a Specified Version of an Object
The following request returns the specified version of an object.
GET /myObject?versionId=3/L4kqtJlcpXroDTDmpUMLUo HTTP/1.1
Host: bucket.s3.amazonaws.com
Date: Wed, 28 Oct 2009 22:32:00 GMT
Authorization: AWS 02236Q3V0WHVSRW0EXG2:0RQf4/cRonhpaBX5sCYVf1bNRuU=
Sample Response to a Versioned Object GET Request
HTTP/1.1 200 OK x-amz-id-2: eftixk72aD6Ap54OpIszj7UDNEHGran x-amz-request-id: 318BC8BC148832E5 Date: Wed, 28 Oct 2009 22:32:00 GMT Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT x-amz-version-id: 3/L4kqtJlcpXroDTDmJ+rmSpXd3QBpUMLUo ETag: "fba9dede5f27731c9771645a39863328" Content-Length: 434234 Content-Type: text/plain Connection: close Server: AmazonS3 [434234 bytes of object data]