Get Object

This SDK method can be used to get an object from the bucket. The response will be in blob format.

When Versioning is enabled for the bucket:

  • If you do not pass the versionId, then only the latest object will be returned.
  • To retrieve a specific version, use the versionId query parameter with a valid version as a value.

Parameters Used

Parameter NameDefinition
nameA mandatory parameter. Will contain the object name.
versionIdAn optional parameter. Will hold the unique version ID of the required object's version.
copy
bucketInstance.getObject("{object_name}", "{version_id}",
    {
        object ->
        println("The name of the object is : ${object.name}")
    },
    {
        exception ->
        println("Get object failed! $exception")
    }
 )

Get All Objects

This SDK method can be used to get all the objects present in the bucket using pagination technique.

Parameters Used

Parameter NameData TypeDefinition
prefixStringAn Optional parameter. This will get the objects that match the prefix value.
max_keysNumberAn Optional parameter. Will contain the maximum limit of objects that can be listed by pagination.
continuation_tokenStringAn Optional parameter. If the response was truncated, the value of this key must be passed as continuation_token to the same method for retrieving the next set of objects.
copy
bucketInstance.getObjects({max_keys}, {continuation_token}, {prefix}, 
    {
        objects ->
        for (obj in objects){
            println("Object name: ${obj.name}")
 }
    },
    {
        exception ->
        println("Get objects failed! $exception")
    }
 )

Last Updated 2026-11-03 13:18:52 +0530 IST