Deleting a KiiObject

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

  • // Instantiate a KiiObject with its URI.
    Uri objUri = Uri.parse("Set the URI of an existing KiiObject here");
    KiiObject object = KiiObject.createByUri(objUri);
    
    try {
      // Delete the KiiObject.
      object.delete();
    } catch (AppException e) {
      // Handle the error.
    } catch (IOException e) {
      // Handle the error.
    }
  • // Instantiate a KiiObject with its URI.
    Uri objUri = Uri.parse("Set the URI of an existing KiiObject here");
    KiiObject object = KiiObject.createByUri(objUri);
    
    // Delete the KiiObject.
    object.delete(new KiiObjectCallBack() {
      @Override
      public void onDeleteCompleted(int token, Exception exception) {
        if (exception != null) {
          // Handle the error.
          return;
        }
      }
    });

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.