Deleting a KiiObject

You can delete a KiiObject by calling the delete() method.

  • // Instantiate a KiiObject with its URI.
    var object = KiiObject.objectWithURI("Set the URI of an existing KiiObject here");
    
    // Delete the KiiObject.
    object.delete().then(
      function(theObject) {
        // Do something.
      }
    ).catch(
      function(error) {
        var theObject = error.target;
        var errorString = error.message;
        // Handle the error.
      }
    );
  • // Instantiate a KiiObject with its URI.
    var object = KiiObject.objectWithURI("Set the URI of an existing KiiObject here");
    
    // Delete the KiiObject.
    object.delete({
      success: function(theObject) {
        // Do something.
      },
      failure: function(theObject, errorString) {
        // Handle the error.
      }
    });

A KiiObject will be deleted from the server by calling the delete() method; you do not need to invoke the save() method.

If you delete a KiiObject which has an object body, the body will be deleted at the same time. If the object body has been published, its URL will be disabled too. See Deleting an Object Body for more details.

Although there is no API for bulk-deleting multiple KiiObjects, you can delete all KiiObjects in a bucket at once by deleting the bucket. See Deleting a Bucket for more details.