ListObjectsV2

Returns some or all (up to 1,000) of the objects in a bucket with each request.

You can use the request parameters as selection criteria to return a subset of the objects in a bucket. A 200 OK response should contain a valid XML. Make sure to design your application to parse the contents of the response and handle this appropriately. Objects are returned sorted in ascending order of the respective key names in the list.

You must have List ACL to be able to call this action.

The following operations are related to ListObjectsV2:

Request Syntax

1GET /?list-type=2&continuation-token=ContinuationToken&delimiter=Delimiter&encoding-type=EncodingType&fetch-owner=FetchOwner&max-keys=MaxKeys&prefix=Prefix&start-after=StartAfter HTTP/1.1
2Host: <BUCKET>.s3.tebi.io

The request uses the following URI parameters:

  • <BUCKET>: Name of the bucket containing the objects. Required.

  • continuation-token: ContinuationToken indicates to Tebi that the list is being continued on this bucket with a token. ContinuationToken is a base64-encoded key.

  • delimiter: Character you use to group keys. Only forward slash / is supported by Tebi as a delimiter.

  • encoding-type: Requests Tebi to encode the object keys in the response and specifies the encoding method to use. Valid Values: url.

  • fetch-owner: Owner field is not present in ListObjectsV2 by default. If you want to return owner field with each key in the result, set the fetch owner field to true.

  • max-keys: Sets the maximum number of keys returned in the response. By default, the action returns up to 1,000 key names. The response might contain fewer keys, but will never contain more.

  • prefix: Limits the response to keys that begin with the specified prefix.

  • start-after: StartAfter is where you want Tebi to start listing from. Tebi starts listing after this specified key. StartAfter can be any key in the bucket.

The request does not have a request body.

Response Syntax

 1HTTP/1.1 200
 2Content-Type: application/xml
 3Content-Length: ContentLength
 4
 5<?xml version="1.0" encoding="UTF-8"?>
 6<ListBucketResult>
 7    <IsTruncated>boolean</IsTruncated>
 8    <Contents>
 9        <ETag>string</ETag>
10        <Key>string</Key>
11        <LastModified>timestamp</LastModified>
12        <Owner>
13            <DisplayName>string</DisplayName>
14            <ID>string</ID>
15        </Owner>
16        <Size>integer</Size>
17        <StorageClass>string</StorageClass>
18    </Contents>
19    ...
20    <Name>string</Name>
21    <Prefix>string</Prefix>
22    <Delimiter>string</Delimiter>
23    <MaxKeys>integer</MaxKeys>
24    <CommonPrefixes>
25        <Prefix>string</Prefix>
26    </CommonPrefixes>
27    ...
28    <EncodingType>string</EncodingType>
29    <KeyCount>integer</KeyCount>
30    <ContinuationToken>string</ContinuationToken>
31    <NextContinuationToken>string</NextContinuationToken>
32    <StartAfter>string</StartAfter>
33</ListBucketResult>

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in XML format by the service:

  • ListBucketResult: Root level tag for the ListBucketResult parameters.

  • CommonPrefixes: All of the keys (up to 1,000) rolled up in a common prefix count as a single return when calculating the number of returns. A response can contain CommonPrefixes only if you specify a delimiter. CommonPrefixes contains all (if there are any) keys between Prefix and the next occurrence of the string specified by the delimiter. CommonPrefixes lists keys that act like subdirectories in the directory specified by Prefix.

  • Contents: Metadata about each object returned.

  • ContinuationToken: If ContinuationToken was sent with the request, it is included in the response.

  • 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. Each rolled-up result counts as only one return against the MaxKeys value. Only forward slash / is supported by Tebi as a delimiter.

  • EncodingType: Encoding type used by Tebi to encode object keys in the response. Valid Values: url.

  • IsTruncated: Flag that indicates whether Tebi returned all of the results that satisfied the search criteria.

  • KeyCount: Number of keys returned with the request. KeyCount will always be less than or equal to the MaxKeys field.

  • MaxKeys: Maximum number of keys returned in the response body.

  • Name: Bucket name.

  • NextContinuationToken: Sent when isTruncated is true and means there are more keys in the bucket that can be listed. The next list requests to Tebi can be continued with this NextContinuationToken.

  • Prefix: Keys that begin with the indicated prefix.

  • StartAfter: If StartAfter was sent with the request, it is included in the response.

See Also

Refer here for more information.