GET Bucket Object Versions

Last updated: 2019-09-25 17:56:07

    Description

    The GET Bucket Object Versions API is used to retrieve all objects in a bucket and their historical version information. You can also filter certain objects and their version information by specifying relevant parameters.The requester needs to have read permissions to the storage bucket.

    Request

    Sample Request

    GET /?versions HTTP 1.1
    Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
    Date: GMT date
    Authorization: Auth String

    Authorization: Auth String (see Request Signature for more information).

    Request Parameter

    Name Description Type Required
    prefix Prefix match used to specify the prefix address of the file returned string No
    delimiter The delimiter is a symbol. If there is a prefix, the identical paths between prefix and delimiter will be grouped into one class and defined as a common prefix, and then all common prefixes will be listed. If there is no prefix, the listing process will start from the beginning of the path string No
    key-marker By default, entries are listed in UTF-8 binary order starting from the marker string No
    encoding-type Specifies the encoding type of the return value. Valid value: url string No
    max-keys Maximum number of entries returned at a time; default and maximum value: 1,000 string No
    version-id-marker Specifies that you need a list of all historical versions of an object starting from the version ID "version-id-marker". Valid values: Valid version ID, Default. If you do not specify any version ID, the latest version of the object will be listed by default string No

    Request Headers

    This API only uses common request headers. For more information, see Common Request Headers.

    Request Body

    This API does not have a request body.

    Response

    Response Headers

    This API only returns common response headers. For more information, see Common Response Headers.

    Response Body

    <ListVersionsResult>
        <Name>exampleBucket-1250000000</Name>
        <Prefix/></Prefix>
        <KeyMarker/></KeyMarker>
        <VersionIdMarker/></VersionIdMarker>
        <MaxKeys></MaxKeys>
        <IsTruncated></IsTruncated>
        <DeleteMarker>
            <Key>exampleObject</Key>
            <VersionId>VersionId</VersionId>
            <IsLatest>true</IsLatest>
            <LastModified>Date</LastModified>
            <Owner>
                <UID>OwnerUin</UID>
            </Owner>
        </DeleteMarker>
        <Version>
            <Key>exampleObject.txt</Key>
            <VersionId>VersionId</VersionId>
            <IsLatest>false</IsLatest>
            <LastModified>Date</LastModified>
            <ETag>ETag</ETag>
            <Size>ObjectSize</Size>
            <StorageClass>StorageClass</StorageClass>
            <Owner>
                <UID>OwnerUin</UID>
            </Owner>
        </Version>
    </ListVersionsResult>

    Below are the details:

    Node Name (Keyword) Parent Node Description Type
    ListVersionsResult None Stores all the information on the results of the Get Bucket request Container

    Content of the Container node ListVersionsResult:

    Node Name (Keyword) Parent Node Description Type
    Name ListVersionsResult Bucket name string
    Encoding-Type ListVersionsResult Encoding type string
    Prefix ListVersionsResult Prefix match used to specify the prefix address of the file returned by the request response string
    KeyMarker ListVersionsResult By default, entries are listed in UTF-8 binary order starting from the marker string
    MaxKeys ListVersionsResult Maximum number of results returned in one response string
    IsTruncated Whether response entries are truncated, which is a boolean value of true or false boolean
    NextMarker ListVersionsResult If the returned entries are truncated, then return NextMarker which marks the start of the next entry string
    DeleteMarker ListVersionsResult Any object that has ever been deleted has a delete marker Container
    Version ListVersionsResult If an object is not deleted and exists in the bucket, this container records the object's metadata Container

    Content of the Container node DeleteMarker:

    Node Name (Keyword) Parent Node Description Type
    Key ListVersionsResult.DeleteMarker Index of the deleted objects string
    VersionId ListVersionsResult.DeleteMarker Object version ID string
    IsLatest ListVersionsResult.DeleteMarker Indicates whether the deleted object is the latest version string
    LastModified ListVersionsResult.DeleteMarker Last modified time of the object string
    Owner ListVersionsResult.DeleteMarker Bucket owner information Container

    Content of the Container node Version:

    Node Name (Keyword) Parent Node Description Type
    Key ListVersionsResult.Version Index of the deleted objects string
    VersionId ListVersionsResult.Version Object version ID string
    IsLatest ListVersionsResult.Version Indicates whether the deleted object is the latest version string
    LastModified ListVersionsResult.Version Last modified time of the object string
    ETag ListVersionsResult.Version An Entity Tag (ETag) is a hash value generated based on the object content rather than the metadata. Different objects have different ETags, so Etag can be used as an indicator of whether the specified object has been modified string
    Size ListVersionsResult.Version The size of the object in bytes string
    StorageClass ListVersionsResult.Version Storage class of the object; enumerators: STANDARD, STANDARD_IA, ARCHIVE string
    Owner ListVersionsResult.Version Bucket owner information Container

    Content of the Container node Owner:

    Node Name (Keyword) Parent Node Description Type
    UID ListVersionsResul t.Contents.Owner Bucket owner's APPID string

    Samples

    Request

    GET /?versions HTTP/1.1
    Host: exampleBucket-1250000000.cos.ap-chengdu.myqcloud.com
    Connection: keep-alive
    Accept: */*
    User-Agent: python-requests/2.12.4
    Authorization: q-sign-algorithm=sha1&q-ak=AKID15IsskiBQKTZbAo6WhgcBqVls9Sm****&q-sign-time=1480932292;1981012292&q-key-time=1480932292;1981012292&q-url-param-list=versions&q-header-list=host&q-signature=5118a936049f9d44482bbb61309235cf4abe****

    Response

    Content-Type: application/xml
    Content-Length: 35524
    Connection: keep-alive
    Date: Fri, 14 Apr 2019 04:14:26 GMT
    Server: tencent-cos
    x-cos-request-id: NWQwMzFmMjJfN2QyZjIyMDlfY2M2MV85MGE5****
    
    <ListVersionsResult>
        <Name>exampleBucket-1250000000</Name>
        <Prefix/>
        <KeyMarker/>
        <VersionIdMarker/>
        <MaxKeys>1000</MaxKeys>
        <IsTruncated>false</IsTruncated>
        <DeleteMarker>
            <Key>100K.txt</Key>
            <VersionId>MTg0NDUxODM2NDIzNDY0MzIxNjQ</VersionId>
            <IsLatest>true</IsLatest>
            <LastModified>2019-06-13T13:09:23.000Z</LastModified>
            <Owner>
                <UID>1250000000</UID>
            </Owner>
        </DeleteMarker>
        <Version>
            <Key>100K.txt</Key>
            <VersionId>MTg0NDUxODM2NDYxNTg1MTgxODk</VersionId>
            <IsLatest>false</IsLatest>
            <LastModified>2019-06-13T12:05:51.000Z</LastModified>
            <ETag>&quot;fffc7956ba9a7b58a63c01b6ce1ddc45&quot;</ETag>
            <Size>102401</Size>
            <StorageClass>STANDARD</StorageClass>
            <Owner>
                <UID>1250000000</UID>
            </Owner>
        </Version>
        <Version>
            <Key>100K.txt</Key>
            <VersionId>null</VersionId>
            <IsLatest>false</IsLatest>
            <LastModified>2019-06-13T10:00:09.000Z</LastModified>
            <ETag>&quot;fffc7956ba9a7b58a63c01b6ce1ddc45&quot;</ETag>
            <Size>102401</Size>
            <StorageClass>STANDARD</StorageClass>
            <Owner>
                <UID>1250000000</UID>
            </Owner>
        </Version>
            <Version>
            <Key>100M.txt</Key>
            <VersionId>MTg0NDUxODM2NDYxNTc0NDc2MTM</VersionId>
            <IsLatest>true</IsLatest>
            <LastModified>2019-06-13T12:06:15.000Z</LastModified>
            <ETag>&quot;5b98499bd9900f3dc433b63a66a35252-101&quot;</ETag>
            <Size>104857601</Size>
            <StorageClass>STANDARD</StorageClass>
            <Owner>
                <UID>1250000000</UID>
            </Owner>
        </Version>
        <Version>
            <Key>100M.txt</Key>
            <VersionId>null</VersionId>
            <IsLatest>false</IsLatest>
            <LastModified>2019-06-13T10:00:47.000Z</LastModified>
            <ETag>&quot;620b3b3e325b1b02823046c946ecde3d-101&quot;</ETag>
            <Size>104857601</Size>
            <StorageClass>STANDARD</StorageClass>
            <Owner>
                <UID>1250000000</UID>
            </Owner>
            </Version>
        <Version>
            <Key>1204M.txt</Key>
            <VersionId>null</VersionId>
            <IsLatest>true</IsLatest>
            <LastModified>2019-06-13T10:05:11.000Z</LastModified>
            <ETag>&quot;6e37bf6cc44744075426c14b4b2aa276-1205&quot;</ETag>
            <Size>1262485505</Size>
            <StorageClass>STANDARD</StorageClass>
            <Owner>
                <UID>1250000000</UID>
            </Owner>
        </Version>
        <Version>
            <Key>25K.txt</Key>
            <VersionId>MTg0NDUxODM2NDYxNTg4NDU5MDE</VersionId>
            <IsLatest>true</IsLatest>
            <LastModified>2019-06-13T12:05:50.000Z</LastModified>
            <ETag>&quot;cabe069ebe3561c35c6a5ae5a362f7a5&quot;</ETag>
            <Size>25601</Size>
            <StorageClass>STANDARD</StorageClass>
            <Owner>
                <UID>1250000000</UID>
            </Owner>
        </Version>
        <Version>
            <Key>25K.txt</Key>
            <VersionId>null</VersionId>
            <IsLatest>false</IsLatest>
            <LastModified>2019-06-13T09:59:59.000Z</LastModified>
            <ETag>&quot;cabe069ebe3561c35c6a5ae5a362f7a5&quot;</ETag>
            <Size>25601</Size>
            <StorageClass>STANDARD</StorageClass>
            <Owner>
                <UID>1250000000</UID>
            </Owner>
        </Version>
        <Version>
            <Key>25M.txt</Key>
            <VersionId>MTg0NDUxODM2NDYxNTg2MTE5MTA</VersionId>
            <IsLatest>true</IsLatest>
            <LastModified>2019-06-13T12:05:58.000Z</LastModified>
            <ETag>&quot;b1b3fcdba0def587df7031e440d623cf-26&quot;</ETag>
            <Size>26214401</Size>
            <StorageClass>STANDARD</StorageClass>
            <Owner>
                <UID>1250000000</UID>
            </Owner>
        </Version>
        <Version>
            <Key>25M.txt</Key>
            <VersionId>null</VersionId>
            <IsLatest>false</IsLatest>
            <LastModified>2019-06-13T10:00:08.000Z</LastModified>
            <ETag>&quot;834f90daf03a8810620175c2f2d4104a-26&quot;</ETag>
            <Size>26214401</Size>
            <StorageClass>STANDARD</StorageClass>
            <Owner>
                <UID>1250000000</UID>
            </Owner>
        </Version>
    </ListVersionsResult>

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help