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

S3 Delete Multiple Objects

See more Amazon S3 Examples

Demonstrates how to delete multiple objects in a single HTTP request.

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 = 'ABQXXABC83ABCDEFVQXX';

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

  final bucketName = 'chilkattestbucket';

  final objectName1 = 'starfish.jpg';
  // Delete a particular version of this object:
  final objectName2 = 'conch.jpg; VersionId="3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo"';
  final objectName3 = 'seaUrchin.jpg';

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

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

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