List Object Versions

List All Versions of an Object Through Pagination

Enabling Versioning in a bucket allows you to store multiple versions of the same object in the bucket. Each version of the object will have its own versionId. This SDK method allows you to get all the existing versions of an object present in a bucket by pagination.

Info: To use this SDK method, you need intialize it with Admin scope. You can learn more about this requirement from this section

Parameters Used

Parameter Name Data Type Definition
next_token String Will hold the value to determine the next set of versions.
max_versions int An Optional parameter. Will hold the value of the maximum number of versions of the object that can be listed per iteration.
    
copy
def list_my_paged_versions(max_versions = None, next_token= None): res = object_ins.list_paged_versions(max_versions, next_token) print(res) if not res['is_truncated']: # return 'true' if more versions are available for the object. Return 'false' no more versions available for the object return list_my_paged_versions(max_versions, next_token) list_my_paged_versions(2)

Example Response

    
copy
{ "key": "downloaded_file.json", "versions_count": 2, "max_versions": "2", "is_truncated": "False", "next_continuation_token": "4YpUdkktt2UeWp6MwEK1LZXELnuVhunHLnGgX29uvszwtJEQE2gVDJYyRiLdUmhNst", "version": [ { "version_id": "01hyfh12njtpyvzwq6p1fd2d8s", "is_latest": "True", "last_modified": "May 22, 2024 12:20 PM", "size": 1, "etag": "9af7c117d9de9a06fba7a5f1ea5fcc2d" }, { "version_id": "01hyfh0xkvwkxxsjfceef201xa", "is_latest": "False", "last_modified": "May 22, 2024 12:20 PM", "size": "1", "etag": "9af7c117d9de9a06fba7a5f1ea5fcc2d" } ] }

List All Versions of the Object Through Iteration

You can use the following SDK method to get all available versions of the object in a single call.

Info: To use this SDK method, you need intialize it with Admin scope. You can learn more about this requirement from this section
    
copy
versions = object_ins.list_iterable_versions(2) for key in versions: print(key)

Example Response

    
copy
{ "version_id": "01hyfh12njtpyvzwq6p1fd2d8s", "is_latest": "True", "last_modified": "May 22,2024 12:20 PM", "size": "1", "etag": "9af7c117d9de9a06fba7a5f1ea5fcc2d" } { "version_id": "01hyfh0xkvwkxxsjfceef201xa", "is_latest": "False", "last_modified": "May 22, 2024 12:20 PM", "size": "1", "etag": "9af7c117d9de9a06fba7a5f1ea5fcc2d" }

Last Updated 2025-07-02 15:43:56 +0530 +0530