Listing bucket contents (version 1)
You use the HTTP GET method to list the contents of a bucket. To list the contents of a bucket, you need browse permission for the bucket. You do not need to be an authenticated user.
For the purpose of a bucket listing, the bucket contents consist not only of the objects you stored in the bucket but also of the folders that you created in the bucket or that HCP created automatically from the object names. For example, by default, if a bucket contains an object named quarterly_rpts/Q4_2019, a list of the bucket contents includes these two items:
- quarterly_rpts/
- quarterly_rpts/Q4_2019
By default, a bucket listing includes only the current (or only) versions of objects. To request a listing that includes old versions of objects, you use the versions query parameter.
A listing that includes versions of objects may include delete markers. A delete marker indicates that a version of the object was deleted.
A bucket listing is returned in an XML response body. In the response body, items in the bucket listing occur in ascending alphanumeric order by item name. If the listing includes multiple versions of an object, those versions are listed in ascending chronological order by last-modified time.
Request line
Depending on whether the bucket name is included in the hostname in the S3 compatible request, a request to list the contents of a bucket of a bucket has either of these formats:
- With the bucket name included in the hostname:
GET /[?[versions][query-parameters]] HTTP/1.1
- With the bucket name following the hostname:
GET /bucket-name[?[versions][query-parameters]] HTTP/1.1
The versions query parameter is not case sensitive.
query-parameters can be none, one, or more of:
delimiter
You use the delimiter query parameter to request a bucket listing that includes a list of common prefixes, where a prefix is the name of an item up through the first occurrence of the character string specified by the delimiter parameter. Each common prefix is listed only once regardless of the number of items with matching names. The items with matching names are not included elsewhere in the listing.
The returned listing also contains items with names that do not include the character string specified by the delimiter parameter. In the listing, all the named items are listed first, followed by all the common prefixes.
The items and common prefixes included in a listing are subject to any other criteria specified in the request.
Both the items and the common prefixes count toward the maximum number of items that can be included in the bucket listing.
The list of items does not include in-progress multipart uploads. The list of common prefixes does not include common prefixes that are exclusively for multipart uploads.
The character string you specify for the delimiter query parameter can contain any valid UTF-8 characters. including white space. Percent-encode non-ASCII characters and reserved special characters such as ampersands (&), commas (,) and equal signs (=). If the character string contains spaces, enclose the entire string in quotation marks.
The delimiter parameter name and the character string you specify are both case sensitive.
encoding-type
You use the encoding-type query parameter to request the S3 compatible API to encode the response. You can also use this query parameter to specify the encoding method to use.
The key for an object can contain any Unicode character. Some characters, such as those with an ASCII value from 0 to 10, cannot be parsed by XML 1.0 parsers. For these characters, you can add the encoding-type query parameter to request the S3 compatible API to encode the keys in the response.
The encoding-type parameter name is case sensitive.
prefix
You use the prefix query parameter to request a bucket listing that contains only items with names that begin with a specified character string (the prefix) and, if applicable, common prefixes that begin that prefix.
For example, the bucket listing returned in response to a GET request with the
prefix=sales
query parameter contains only these items:sales/ sales/budget_proposals/ sales/budget_proposals/BudgProp-2020 sales_quotas_2020.pdf
The list of items does not include in-progress multipart uploads or common prefixes that are exclusively for multipart uploads.
The character string you specify for the prefix query parameter can contain any valid UTF-8 characters. including white space. Percent-encode non-ASCII characters and reserved special characters such as ampersands (&), commas (,) and equal signs (=). If the character string contains spaces, enclose the entire string in quotation marks.
The prefix parameter name and the character string you specify are both case sensitive.
max-keys
By default, a bucket listing can include at most one thousand items. However, you can use the max-keys query parameter in a bucket listing request to specify a smaller maximum number of items. If more than the maximum number of items satisfy the criteria for a request, you can use query parameters to retrieve the parts in groups.
For example, the bucket listing returned in response to a GET request with the
max-keys=6
query parameter contains these items:AcctgBestPractices.doc (current version) acctg/ acctg/AcctgRR-Summary acctg/budget_proposals/ acctg/budget_proposals/BudgProp-2020 hum_res/
Valid values for the max-keys query parameter are integers in the range 0 (zero) through 2,147,483,647. If you specify an integer greater than one thousand, the returned bucket listing includes only the first one thousand items that satisfy the request criteria (or fewer if fewer than one thousand items satisfy the criteria).
The max-keys parameter name is case sensitive.
marker
You use the marker query parameter to start the returned bucket listing with the first item with a name that comes alphanumerically after the character string specified by the marker parameter.
For example, the bucket listing returned in response to a GET request with the
marker=quarterly_rpts/
query parameter contains these items:quarterly_rpts/Q2_2019.ppt quarterly_rpts/Q3_2019.ppt quarterly_rpts/Q4_2019.ppt sales/ sales/budget_proposals/ sales/budget_proposals/BudgProp-2020 sales_quotas_2020.pdf
When more than the requested number of items satisfy the criteria in a request for a bucket listing, HCP returns a partial listing. In this case, the response body includes the
IsTruncated
element with a value of true. You can request the next part of the listing by including the marker query parameter in a new request. As the parameter value, you specify either the name of the last item in the returned listing or the last common prefix in the returned listing, whichever is alphanumerically greater.If the string you specify as the value of the marker query parameter is the name of a folder and does not end with a forward slash (/), items that begin with that string followed by a forward slash are omitted from the listing.
The character string you specify for the marker query parameter can contain any valid UTF-8 characters. including white space. Percent-encode non-ASCII characters and reserved special characters such as ampersands (&), commas (,) and equal signs (=). If the character string contains spaces, enclose the entire string in quotation marks.
The marker parameter name and the character string you specify are both case sensitive.
The marker parameter is ignored if specified in a GET request that includes the versions parameter.
version-id-marker
You use the version-id-marker parameter in conjunction with the key-marker parameter to start the returned bucket listing with the first item with:
- A name that’s equal to the character string specified by the key-marker parameter
- A version ID that’s greater than the value specified by the version-id-marker parameter
If no such item exists, the returned bucket listing starts with the first item with a name that's alphanumerically greater than the character string specified by the key-marker parameter.
For example, the version ID of the first version of the object named mktg/campaign_GoGetEm_expenses.xls is 87288784288321. The bucket listing returned in response to a GET request with the
key-marker=mktg/campaign_GoGetEm_expenses.xls and version-id-marker=87288784288321
query parameters contains only these items:mktg/campaign_GoGetEm_expenses.xls (second version) mktg/campaign_LiveIt_expenses.xls quarterly_rpts/ quarterly_rpts/Q2_2019.ppt quarterly_rpts/Q3_2019.ppt quarterly_rpts/Q4_2019.ppt sales/ sales/budget_proposals/ sales/budget_proposals/BudgProp-2020 sales_quotas_2020.pdf
When the response body for a version listing request includes the
IsTruncated
element with a value oftrue
, the response body also includes theNextKeyMarker
andNextVersionIdMarker
elements. If the alphanumerically last item in the version listing is:- Is a named item, the values of the
NextKeyMarker
andNextVersionIdMarker
elements are the name and version ID of that item, respectively - Is a common prefix, the value the
NextKeyMarker
element is that prefix, andNextVersionIdMarker
is an empty element.
To request the next part of the listing, you include the key-marker and version-id-marker query parameters in a new request. For the value of the key-marker parameter, you use the value of the
NextKeyMarker
element from the previously returned listing. For the value of the version-id-marker parameter, you use the value of theNextVersionIdMarker
element from the previously returned listing.Valid values for the version-id-marker query parameter are integers greater than or equal to zero.
The version-id-marker parameter name is case sensitive.
Request headers
The list below describes the headers you can use in a request to list the contents of a bucket.
Authorization
Specifies user credentials or requests anonymous access.
Date
Specifies the date and time when the request is being made according to the requester. Normally, this is the current date and time.
The date and time must always be specified using Greenwich Mean Time (GMT).
To specify the date and time, use this format:
DDD, dd MMM yyyy HH:mm:ss (+0000|GMT)
In this format:
DDD
The three-letter abbreviation for the day of the week, with an uppercase first letter (for example, Mon).
dd
The two-digit day of the month.
MMM
The three-letter abbreviation for the month, with an uppercase first letter (for example, Feb).
yyyy
The four-digit year.
HH
The hour on a 24-hour clock.
mm
The number of minutes.
ss
The number of seconds.
For example:
Thu, 23 Mar 2017 14:27:05 +0000
All S3 compatible requests must include either a
Date
header or anx-amz-date
header. If a request includes both headers, HCP uses the date and time in thex-amz-date
header.Host
Specifies the hostname for the request. The host name identifies either a tenant or a bucket.
For a tenant, use this format:
tenant-name.hcp-domain-name
For a bucket, use this format:
bucket-name.tenant-name.hcp-domain-name
x-amz-date
Specifies the date and time at which the request is being made according to the requester. Normally, this is the current date and time.
For the valid values for this header, see the description of the
Date
header above.x-hcp-pretty-print
Optionally, requests that the XML response body be formatted for readability. Valid values are:
true
Format the XML response body for readability.
false
Do not apply any special formatting to the XML response body.
The default is false.
The values
true
andfalse
are not case sensitive.
Response headers
The list below describes the headers returned in response to a successful request to list the contents of a bucket.
Content-Type
Specifies the Internet media type of the response body. For a request to list the contents of a bucket, the value of this header is always
application/xml;charset=UTF-8
.Date
The date and time when HCP responded to the request, in Greenwich Mean Time (GMT). The date and time are returned in this format:
DDD dd MMM yyyy HH:mm:ss GMT
For example:
Fri, 18 Sep 2020 14:27:05 GMT
Transfer-Encoding
Indicates that HCP could not determine the size of the response body before formulating the response. For a request to list the buckets you own, the value of this header is always
chunked
.
Response body
The response body returned in response to a request to list the contents of a bucket differs depending on whether request is for the current (or only) versions of objects or for object versions.
The list below describes the XML elements in the two formats of the response body returned in response to a request to list the contents of a bucket. The elements are listed in alphabetical order.
CommonPrefixes
Child of the
ListBucketResult
orListVersionsResult
element and container for thePrefix
element.The response body contains one
CommonPrefixes
element for each common prefix in the bucket listing.Contents
Child of the
ListBucketResult
element and container for the elements that describe a current item in the bucket.The response body contains one
Contents
element for each item that satisfies the request criteria.DeleteMarker
Child of the
ListVersionsResult
element and container for the elements that describe a delete marker.The response body contains one
DeleteMarker
element for each delete marker that satisfies the request criteria.Delimiter
Child of the
ListBucketResult
orListVersionsResult
element.The
Delimiter
element specifies the value of the delimiter query parameter included in the request. If the request did not include the delimiter query parameter, the response body does not include theDelimiter
element.DisplayName
Child of the
Owner
element.If the item owner is identified by an HCP user account, the value of the
DisplayName
element is the user name for that account. If the item owner is identified by an AD user account, the value of theDisplayName
element is the user name of that account followed by an at sign (@) and the AD domain name.If the item has no owner, the value of the
DisplayName
element isnobody
.For folders, the value of the
DisplayName
element is alwaysnobody
.ETag
Child of the
Contents
orVersion
element.The
ETag
element specifies the ETag of the applicable item or item version.The response body includes
ETag
elements for the listed folders. However, because they have no content, all folders have the same value for this element.ID
Child of the
Owner
element.If the item owner is identified by an HCP user account, the value of the
ID
element is the user ID for that account. If the item owner is identified by an AD user account, the value of theID
element is the SID for that account.If the item has no owner, the value of the
ID
element isnobody
.For folders, the value of the
ID
element is alwaysnobody
.IsLatest
Child of the
Version
orDeleteMarker
element.The
IsLatest
element indicates whether the item version is the current version of the item. Possible values are:true
The item version is the current version of the item.
false
The item version is an old version of the item.
IsTruncated
Child of the
ListBucketResult
orListVersionsResult
element.The
IsTruncated
element indicates whether the returned bucket listing includes the last item that satisfies the request criteria. Possible values are:true
The returned listing includes the last item that satisfies the request criteria.
false
The returned listing does not include the last item that satisfies the request criteria.
Key
Child of the
Contents
,Version
, orDeleteMarker
element.The
Key
element specifies the name of an item or item version in the bucket listing. For a delete marker, the value of theKey
element is the name of the object or object version that was deleted.KeyMarker
Child of the
ListVersionsResult
element.The
KeyMarker
element specifies the value of the key-marker query parameter included in the request. If the request did not include the key-marker query parameter, the response body includesKeyMarker
as an empty element.LastModified
Child of the
Contents
,Version
, orDeleteMarker
element.The
LastModified
element specifies the date and time when the applicable item or item version was last modified, in Greenwich Mean Time (GMT). For a delete marker, this is the date and time when the delete marker was created.The date and time are expressed in this format:
yyyy-MM-ddTHH:mm:ss.SSSZ
For example:
2020-02-18T19:46:03.856Z
Modifying an object means modifying its metadata. You cannot modify the content of an object.
ListBucketResult
Root element for a listing of current items.
ListVersionsResult
Root element for a version listing.
Marker
Child of the
ListBucketResult
element.The
Marker
element specifies the value of the marker query parameter included in the request. If the request did not include the marker query parameter, the response body includesMarker
as an empty element.MaxKeys
Child of the
ListBucketResult
orListVersionsResult
element.The
MaxKeys
element specifies the value of the max-keys query parameter included in the request. If the request did not include the max-keys query parameter, the value of theMaxKeys
element is 1000.Name
Child of the
ListBucketResult
orListVersionsResult
element.The
Name
element specifies the name of the applicable bucket.NextMarker
Child of the
ListBucketResult
element.If the returned listing is truncated, you can use the
NextMarker
element as the value of the marker query parameter in a new request to retrieve the next set of items that satisfy the request criteria.The
NextMarker
element is returned only if you have specified a delimiter request parameter.NextKeyMarker
Child of the
ListVersionsResult
element.The
NextKeyMarker
element specifies the name of the last item included in the returned bucket listing. This element is included in the response body only when the value of theIsTruncated
element istrue
.If the returned listing is truncated, you can use the value of the
NextKeyMarker
element as the value of the key-marker query parameter in a new request to retrieve the next set of items that satisfy the request criteria.NextVersionIdMarker
Child of the
ListVersionsResult
element.The
NextVersionIdMarker
element specifies the version ID of the last item included in the returned bucket listing. This element is included in the response body only when the value of theIsTruncated
element istrue
.If the returned listing is truncated, you can use the value of the
NextVersionIdMarker
element as the value of the version-id-marker query parameter in a new request to retrieve the next set of items that satisfy the request criteria.Owner
Child of the
Contents
,Version
, orDeleteMarker
element and container for theDisplayName
andID
elements.The
Owner
element identifies the owner of the applicable item.Prefix
One of these:
- Child of the
ListBucketResult
orListVersionsResult
element.In this case, the
Prefix
element specifies the value of the prefix query parameter included in the request. If the request did not include the prefix query parameter, the response body includesPrefix
as an empty element. - Child of the
CommonPrefixes
element.In this case, the
Prefix
element specifies a common prefix.
- Child of the
Size
Child of the
Contents
orVersion
element.The
Size
element specifies the size, in bytes, of the content of the item or item version.The response body includes
Size
elements for the listed folders. However, because folders have no content, the value of this element for a folder is always0
(zero).StorageClass
Child of the
Contents
orVersion
element.The value of the
StorageClass
element is always STANDARD.Version
Child of the
ListVersionsResult
element and container for the elements that describe a version of an item in the bucket.The response body contains one
Version
element for each item version that satisfies the request criteria.VersionId
Child of the
Version
orDeleteMarker
element.The
VersionId
element specifies the version ID of an item version.VersionIdMarker
Child of the
ListVersionsResult
element.The
VersionIdMarker
element specifies the value of the version-id-marker query parameter included in the request. If the request did not include the version-id-marker query parameter, the response body includesVersionIdMarker
as an empty element.
Return codes
The table below describes HTTP status codes that can be returned in response to a request to list the contents of a bucket.
Code | Meaning | Description |
200 | OK | HCP successfully retrieved the requested bucket listing. |
400 | Bad Request | Possible reasons include that a query parameter has an invalid value. |
403 | Forbidden |
Possible reasons include:
|
404 | Not Found | The specified bucket does not exist. |
500 | Internal Server Error |
An internal error occurred. If this error persists, contact your tenant administrator. |
503 | Service Unavailable |
HCP is temporarily unable to handle the request, probably due to system overload, maintenance, or upgrade. Try the request again, gradually increasing the delay between each successive attempt. If this error persists, contact your tenant administrator. |
Example: Listing the items in a folder
Here’s a sample GET request for a bucket listing that lists the objects that are in the mktg folder and, separately, the subfolders that are in the mktg folder. The request uses these query parameters:
prefix=mktg/
Lists only items that start with mktg/
marker=mktg/
Starts the listing with the item that follows mktg/ by itself
delimiter=/
Treats items that have a forward slash (/) after mktg/ as having a common prefix
Request with s3curl command line
./s3curl.pl --id=lgreen -- -k "https://finance.europe.hcp.example.com?prefix=mktg/ &marker=mktg/&delimiter=/" -H "x-hcp-pretty-print: true"
Request headers
GET /?prefix=mktg/&delimiter=/&marker=mktg/ HTTP/1.1 Host: finance.europe.hcp.example.com Date: Fri, 07 February 2020 17:19:26 +0000 Authorization: AWS bGdyZWVu:ysiVYJ/cOr78z69BuDy6fy07ryo= x-hcp-pretty-print: true
Response headers
HTTP/1.1 200 OK Date: Fri, 07 February 2020 17:19:26 GMT Content-Type: application/xml;charset=UTF-8 Transfer-Encoding: chunked
Response body
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Name>finance</Name> <Prefix>mktg/</Prefix> <Marker>mktg/</Marker> <MaxKeys>1000</MaxKeys> <Delimiter>/</Delimiter> <IsTruncated>false</IsTruncated> <Contents> <Key>mktg/campaign_GoGetEm_expenses.xls</Key> <LastModified>2020-02-13T17:44:53.000Z</LastModified> <ETag>"6ed7faad1e0661c03ad65a4317d4a94c"</ETag> <Size>94328</Size> <Owner> <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID> <DisplayName>lgreen</DisplayName> </Owner> <StorageClass>STANDARD</StorageClass> </Contents> <Contents> <Key>mktg/campaign_LiveIt_expenses.xls</Key> <LastModified>2019-12-05T14:32:29.110Z</LastModified> <ETag>"7ad452af1e2f61b33a865c4362be5921"</ETag> <Size>81578</Size> <Owner> <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID> <DisplayName>lgreen</DisplayName> </Owner> <StorageClass>STANDARD</StorageClass> </Contents> <CommonPrefixes> <Prefix>mktg/budget_proposals/</Prefix> </CommonPrefixes> </ListBucketResult>
Example: Request for the first three items
Here are two sample GET requests for bucket listings that list item versions. The first request returns a list of three items. The second request returns a list of the three items that follow the last item returned by the first request.
The request for the first three items uses these query parameters:
versions
Lists item versions
key-marker=mktg/
Starts the listing with the item that follows mktg/ by itself
max-keys=3
Lists at most three items
Request with s3curl command line
./s3curl.pl --id=lgreen -- -k "https://finance.europe.hcp.example.com?versions &key-marker=mktg/&max-keys=3" -H "x-hcp-pretty-print: true"
Request headers
GET /?versions&key-marker=mktg/&max-keys=3 HTTP/1.1 Host: finance.europe.hcp.example.com Date: Fri, 07 February 2020 17:19:26 +0000 Authorization: AWS bGdyZWVu:sf4WfS+TzOj9zrHVRA5Z0i1KsFg= x-hcp-pretty-print: true
Response headers
HTTP/1.1 200 OK Date: Fri, 07 February 2020 17:19:26 GMT Content-Type: application/xml;charset=UTF-8 Transfer-Encoding: chunked
Response body
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ListVersionsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Name>finance</Name> <Prefix></Prefix> <KeyMarker>mktg/</KeyMarker><VersionIdMarker></VersionIdMarker> <NextKeyMarker>mktg/campaign_GoGetEm_expenses.xls</NextKeyMarker> <NextVersionIdMarker>87288784288321</NextVersionIdMarker> <MaxKeys>3</MaxKeys> <IsTruncated>true</IsTruncated> <Version> <Key>mktg/budget_proposals/</Key> <VersionId>87288779571521</VersionId> <IsLatest>true</IsLatest> <LastModified>2019-11-13T17:12:00.805Z</LastModified> <ETag>"d41d8cd98f00b204e9800998ecf8427e"</ETag> <Size>0</Size> <Owner> <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID> <DisplayName>lgreen</DisplayName> </Owner> <StorageClass>STANDARD</StorageClass> </Version> <Version> <Key>mktg/budget_proposals/BudgProp-2020</Key> <VersionId>87288779576769</VersionId> <IsLatest>true</IsLatest> <LastModified>2019-11-13T17:12:01.218Z</LastModified> <ETag>"af65fc4d3e90617b3ad65a83a946be11"</ETag> <Size>124591</Size> <Owner> <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID> <DisplayName>lgreen</DisplayName> </Owner> <StorageClass>STANDARD</StorageClass> </Version> <Version> <Key>mktg/campaign_GoGetEm_expenses.xls</Key> <VersionId>87288784288321</VersionId> <IsLatest>false</IsLatest> <LastModified>2020-02-12T20:14:06.519Z</LastModified> <ETag>"74d824cd5076a1361da128ee18e5a42b"</ETag> <Size>92127</Size> <Owner> <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID> <DisplayName>lgreen</DisplayName> </Owner> <StorageClass>STANDARD</StorageClass> </Version> </ListVersionsResult>
Example: Request for next three items
The request for the next three items uses these query parameters:
versions
Lists item versions.
key-marker=mktg/campaign_GoGetEm_expenses.xls
version-id-marker=87288784288321
Starts the listing with the item that follows version 87288784288321 of mktg/campaign_GoGetEm_expenses.xls. The version ID and item name are the values of the
NextVersionIdMarker
andNextKeyMarker
elements from the previous response body, respectively.max-keys=3
Lists at most three items.
Request with s3curl command line
./s3curl.pl --id=lgreen -- -k "https://finance.europe.hcp.example.com?versions &key-marker=mktg/campaign_GoGetEm_expenses.xls &version-id-marker=87288784288321&max-keys=3" -H "x-hcp-pretty-print: true"
Request headers
GET /?versions&key-marker=mktg/campaign_GoGetEm_expenses.xls &version-id-marker=87288784288321&max-keys=3 HTTP/1.1 Host: finance.europe.hcp.example.com Date: Thu, 23 Feb 2017 17:20:01 +0000 Authorization: AWS bGdyZWVu:eYSJshWGcAf7i51jbpl/ZQqqJYM= x-hcp-pretty-print: true
Response headers
HTTP/1.1 200 OK Date: Thu, 23 Feb 2017 17:20:01 GMT Content-Type: application/xml;charset=UTF-8 Transfer-Encoding: chunked
Response body
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ListVersionsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Name>finance</Name> <Prefix></Prefix> <KeyMarker>mktg/campaign_GoGetEm_expenses.xls</KeyMarker> <VersionIdMarker>87288784288321</VersionIdMarker> <NextKeyMarker>quarterly_rpts/</NextKeyMarker> <NextVersionIdMarker>87288727467201</NextVersionIdMarker> <MaxKeys>3</MaxKeys> <IsTruncated>true</IsTruncated> <Version> <Key>mktg/campaign_GoGetEm_expenses.xls</Key> <VersionId>87288825190337</VersionId> <IsLatest>true</IsLatest> <LastModified>2020-02-13T17:44:53.000Z</LastModified> <ETag>"6ed7faad1e0661c03ad65a4317d4a94c"</ETag> <Size>94328</Size> <Owner> <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID> <DisplayName>lgreen</DisplayName> </Owner> <StorageClass>STANDARD</StorageClass> </Version> <Version> <Key>mktg/campaign_LiveIt_expenses.xls</Key> <VersionId>87288785222273</VersionId> <IsLatest>true</IsLatest> <LastModified>2019-11-5T14:32:29.110Z</LastModified> <ETag>"7ad452af1e2f61b33a865c4362be5921"</ETag> <Size>81578</Size> <Owner> <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID> <DisplayName>lgreen</DisplayName> </Owner> <StorageClass>STANDARD</StorageClass> </Version> <Version> <Key>quarterly_rpts/</Key> <VersionId>87288727467201</VersionId> <IsLatest>true</IsLatest> <LastModified>2019-07-23T18:26:24.675Z</LastModified> <ETag>"d41d8cd98f00b204e9800998ecf8427e"</ETag> <Size>0</Size> <Owner> <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID> <DisplayName>lgreen</DisplayName> </Owner> <StorageClass>STANDARD</StorageClass> </Version> </ListVersionsResult>
Example: Listing the versions of an individual object
Here’s a sample GET request for a bucket listing that lists all the versions of the object named AcctgBestPractices.doc and includes one delete marker, indicating that one version was deleted. The request uses these query parameters:
versions
Lists item versions
prefix=AcctgBestPractices.doc
Lists only items that start with AcctgBestPractices.doc
Request with s3curl command line
./s3curl.pl --id=lgreen -- -k "https://finance.europe.hcp.example.com?versions &prefix=AcctgBestPractices.doc" -H "x-hcp-pretty-print: true"
Request headers
GET /?versions&prefix=AcctgBestPractices.doc HTTP/1.1 Host: finance.europe.hcp.example.com Date: Fri, 07 February 2020 17:19:26 +0000 Authorization: AWS bGdyZWVu:zkfUJoEb+pOrtVpxxOHeamoD4cI= x-hcp-pretty-print: true
Response headers
HTTP/1.1 200 OK Date: Fri, 07 February 2020 17:19:26 GMT Content-Type: application/xml;charset=UTF-8 Transfer-Encoding: chunked
Response body
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ListVersionsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Name>finance</Name> <Prefix>AcctgBestPractices.doc</Prefix> <KeyMarker></KeyMarker> <VersionIdMarker></VersionIdMarker> <MaxKeys>1000</MaxKeys> <IsTruncated>false</IsTruncated> <Version> <Key>AcctgBestPractices.doc</Key> <VersionId>87288758401473</VersionId> <IsLatest>false</IsLatest> <LastModified>2019-05-29T14:56:05.630Z</LastModified> <ETag>"26aa5129552e57fc64e10aa5b3911ee2"</ETag> <Size>3206178</Size> <Owner> <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID> <DisplayName>lgreen</DisplayName> </Owner> <StorageClass>STANDARD</StorageClass> </Version> <Version> <Key>AcctgBestPractices.doc</Key> <VersionId>87288800665537</VersionId> <IsLatest>false</IsLatest> <LastModified>2019-10-28T19:23:31.305Z</LastModified> <ETag>"b7235e841a2cc45a7e42a8a576d493b1"</ETag> <Size>3374982</Size> <Owner> <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID> <DisplayName>lgreen</DisplayName> </Owner> <StorageClass>STANDARD</StorageClass> </Version> <Version> <Key>AcctgBestPractices.doc</Key> <VersionId>87288808614529</VersionId> <IsLatest>false</IsLatest> <LastModified>2019-12-28T21:06:52.011Z</LastModified> <ETag>"5ab7542f753b09fdb73141a66c134b9"</ETag> <Size>3557448</Size> <Owner> <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID> <DisplayName>lgreen</DisplayName> </Owner> <StorageClass>STANDARD</StorageClass> </Version> <DeleteMarker> <Key>AcctgBestPractices.doc</Key> <VersionId>87288810855745</VersionId> <IsLatest>false</IsLatest> <LastModified>2019-12-29T13:10:04.902Z</LastModified> <Owner> <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID> <DisplayName>lgreen</DisplayName> </Owner> </DeleteMarker> <Version> <Key>AcctgBestPractices.doc</Key> <VersionId>87288815588289</VersionId> <IsLatest>true</IsLatest> <LastModified>2019-12-29T19:42:16.331Z</LastModified> <ETag>"764f38262c6e581f678e1ac9b0211ae8"</ETag> <Size>3552369</Size> <Owner> <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID> <DisplayName>lgreen</DisplayName> </Owner> <StorageClass>STANDARD</StorageClass> </Version> </ListVersionsResult>