Example 1: Conditionally retrieving an object

Here’s a sample GET request that retrieves the current version of the object named mktg/campaign_GoGetEm_expenses.xls in the finance bucket only if the ETag for the object doesn’t match a specified value. In this example, the specified value is the ETag of the first version of mktg/campaign_GoGetEm_expenses.xls. The request writes the object data to a file named mktg_GoGetEm.xls. The request is being made while versioning is enabled for the bucket.

Request with s3curl command line

./s3curl.pl --id=lgreen -- -k
     "https://finance.europe.hcp.example.com/mktg/campaign_GoGetEm_expenses.xls"
     -H 'If-None-Match:"74d824cd5076a1361da128ee18e5a42b"' >
     mktg_GoGetEm.xls

Request headers

GET /mktg/campaign_GoGetEm_expenses.xls HTTP/1.1
Host: finance.europe.hcp.example.com
Date: Fri, 07 February 2020 17:19:26 +0000
Authorization: AWS bGdyZWVu:3ymfU6KeNWnFEvpphFxYvJ881Wg=
If-None-Match: "74d824cd5076a1361da128ee18e5a42b"

Response headers

HTTP/1.1 200 OK
Date: Fri, 07 February 2020 17:19:26 GMT
ETag: "6ed7faad1e0661c03ad65a4317d4a94c"
Accept-Ranges: bytes
x-amz-version-id: 87288825190337
Last-Modified: Mon, 13 Feb 2017 17:44:53 GMT
Content-Type: application/vnd.ms-excel
Content-Length: 94328

© 2015, 2020 Hitachi Vantara LLC. All rights reserved.