The ListBucket operation returns information about some of the
items in the bucket.
For a general introduction to the list operation, see the Listing Keys.
Example
This example lists up to 40 keys in the "quotes" bucket that have the prefix "N" and occur lexigraphically after "Ned".
Sample Request
<ListBucket xmlns="http://doc.s3.amazonaws.com/2006-03-01"> <Bucket>quotes</Bucket> <Prefix>N</Prefix> <Marker>Ned</Marker> <MaxKeys>40</MaxKeys> <AWSAccessKeyId>1D9FVRAYCP1VJEXAMPLE=</AWSAccessKeyId> <Timestamp>2006-03-01T12:00:00.183Z</Timestamp> <Signature>Iuyz3d3P0aTou39dzbqaEXAMPLE=</Signature> </ListBucket>
Sample Response
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<Name>quotes</Name>
<Prefix>N</Prefix>
<Marker>Ned</Marker>
<MaxKeys>40</MaxKeys>
<IsTruncated>false</IsTruncated>
<Contents>
<Key>Nelson</Key>
<LastModified>2006-01-01T12:00:00.000Z</LastModified>
<ETag>"828ef3fdfa96f00ad9f27c383fc9ac7f"</ETag>
<Size>5</Size>
<StorageClass>STANDARD</StorageClass>
<Owner>
<ID>bcaf1ffd86f41caff1a493dc2ad8c2c281e37522a640e161ca5fb16fd081034f</ID>
<DisplayName>webfile</DisplayName>
</Owner>
</Contents>
<Contents>
<Key>Neo</Key>
<LastModified>2006-01-01T12:00:00.000Z</LastModified>
<ETag>"828ef3fdfa96f00ad9f27c383fc9ac7f"</ETag>
<Size>4</Size>
<StorageClass>STANDARD</StorageClass>
<Owner>
<ID>bcaf1ffd86f41caff1a493dc2ad8c2c281e37522a640e161ca5fb16fd081034f</ID>
<DisplayName>webfile</DisplayName>
</Owner>
</Contents>
</ListBucketResult>For comprehensive information about the list request parameters, see Common List Request Parameters.
Prefix: Limits the response to keys that begin with the indicated prefix. You can use prefixes to separate a bucket into different sets of keys in a way similar to how a file system uses folders. This is an optional argument.Marker: Indicates where in the bucket to begin listing. The list includes only keys that occur alphabetically after marker. This is convenient for pagination: To get the next page of results use the last key of the current page as the marker. The most keys you'd like to see in the response body. The server might return less than this number of keys, but will not return more. This is an optional argument.Delimiter:
Causes keys that contain the same string between
the prefix and the first occurrence of the delimiter to be
rolled up into a single result element in the CommonPrefixes
collection. These rolled-up keys are not returned elsewhere in
the response.
MaxKeys:
This optional argument limits the number of results returned in
response to your query. Amazon S3 will return at most this number
of results, but possibly less. For the purpose of counting MaxKeys,
a 'result' is either a key in the 'Contents' collection, or a
delimited prefix in the 'PrefixRollup' collection.
For information about the list response, see Common List Response Elements.
To list the keys of a bucket you need to have been granted READ access on the bucket.