List Object VersionsAdmin Scope

Note: Ensure you have installed the required package to use this SDK method.

If Versioning is enabled for your bucket, you will be able to store multiple versions of the same object. Each version of the object will be assigned a unique versionID at time time of storage.

The following SDK methods will allow you list all the versions of an object either in a paginated or iterated manner.

List All Versions of an Object Through Pagination

Parameters Used

Parameter Name Data Type Definition
nextToken String Will hold the value that determines the next set of versions.
maxVersions Int An optional parameter. Will hold the value of the maximum number of versions of the object that can be listed per iteration.

You can use the listMyPaginatedVersions() SDK method, to list all the versions of a required object in a paginated manner. The objectIns, object reference used in the following code snippet is the component instance.

copy
async function listMyPaginatedVersions(maxVersion = undefined, nextToken = undefined) {
const response = await objectIns.listPagedVersions({ maxVersion, nextToken}); console.log(response.version); if(response.is_truncated) { listMyPaginatedVersions(maxVersion,nextToken) } } await listMyPaginatedVersions(10);

Example of Expected Response

copy
{
  "key": "sam/out/sample.txt",
  "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 an Object Through Iteration

You can use the listIterableVersions() SDK method to get all the available versions of an object stored in a bucket in Stratus in a single call. The objectIns, object reference used in the following code snippet is the component instance.

copy
const versions = objectIns.listIterableVersions();
for await( const version of versions) {
 console.log(version);
}

Example of Expected Response

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

Last Updated 2026-07-02 14:51:41 +0530 IST