Delete an Object From a Bucket
To delete an object from the bucket:
The delete action will be scheduled, and it will take a short while before the operation is rendered in the console.
Delete operations can be performed on multiple objects and on multiple paths in the same manner.
You can also use the Delete button present in the object details view to delete the object.
Ensure the following packages are imported:
import org.json.simple.JSONObject;
int ttl = 200;
JSONObject deleteRes = bucket.deleteObject(“objectName”, “versionId”, ttl);
System.out.println(deleteRes);
const res = await bucket.deleteObject(“objectName”);
console.log(res);
delete_res = bucket.delete_object(‘object_name’)
print(delete_res)
// Delete an object
const deleteObject = await bucket.deleteObject(“objectName”);
objectInstance.delete() { error in
if let error = error {
print(“Error : \( error )”)
return
}
print(“Deleted Successfully”)
}
bucketInstance.getObject(“SunSet.jpeg”, “2823000000044005”, //Replace this with your Object Name and Object ID
{
object -> object.delete(
{
println(“Object Deletion Success.”)
},
{
println(“Failed to delete the object. $it”)
}
)
try {
ZCatalystBucket bucket = stratus.bucket(“testing”);
var (response, objects, _) = await bucket.getObjects(maxKeys: 5, prefix: ’trip’);
var response = await bucket.deleteObjects(objects);
print(“Delete Objects: ${response.statusCode}”);
}
on ZCatalystException catch (ex) {
print(ex.toString());
}
Last Updated 2025-07-02 15:43:56 +0530 IST
Yes
No
Send your feedback to us