Deleting a Bucket

You can delete a bucket by calling the delete() method of the KiiBucket class. All KiiObjects in the bucket will be deleted accordingly.

Here is the sample code showing how you can delete a bucket:

  • var user = KiiUser.getCurrentUser();
    var bucket = user.bucketWithName("score_card");
    bucket.delete({
      success: function(theBucket) {
        // Do something.
      },
      failure: function(theBucket, errorString) {
        // Handle the error.
      }
    });
  • var user = KiiUser.getCurrentUser();
    var bucket = user.bucketWithName("score_card");
    bucket.delete().then(
      function(theBucket) {
        // Do something.
      }
    ).catch(
      function(error) {
        var theBucket = error.target;
        var anErrorString = error.message;
        // Handle the error.
      }
    );