Sample code for 30+ languages & platforms
Dart Requires Chilkat v11.0.0+

Wasabi Delete Bucket Objects

See more Wasabi Examples

Demonstrates how to delete one or more objects in a bucket.

Chilkat Dart Downloads

Dart
import 'package:chilkat/chilkat.dart';

void main() {
  // This example requires the Chilkat API to have been previously unlocked.
  // See Global Unlock Sample for sample code.

  final http = CkHttp();

  // Insert your access key here:
  http.awsAccessKey = 'access-key';

  // Insert your secret key here:
  http.awsSecretKey = 'secret-key';

  // Use the endpoint matching the bucket's region.
  http.awsEndpoint = 's3.us-west-1.wasabisys.com';

  final bucketName = 'chilkattest';

  final objectName1 = 'seahorse.jpg';
  final objectName2 = 'seahorse2.jpg';

  final st = CkStringTable();
  st.append(objectName1);
  st.append(objectName2);

  final jsonResp = CkJsonObject();
  try {
    http.s3DeleteObjects(bucketName, st, jsonResp);
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  print('Response status code = ${http.lastStatus}');

  // Display the JSON response.
  jsonResp.emitCompact = false;
  print(jsonResp.emit());
}