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

Backblaze S3 Delete Bucket Objects

See more Backblaze S3 Examples

Demonstrates how to delete 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();

  // keyID = Access Key ID or Access Key
  http.awsAccessKey = 'access-key';

  // applicationKey = Secret Access Key or Secret Key
  http.awsSecretKey = 'secret-key';

  // Region is the 2nd part of your S3 Endpoint
  http.awsEndpoint = 's3.us-west-002.backblazeb2.com';

  final bucketName = 'chilkat-test';

  final objectName1 = 'seahorse.jpg';
  final objectName2 = 'orchard.json';

  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());
}