---
title: Delete operation
description: The delete operation interface enables the connector to delete an object on the target system. The operation includes one method (delete()). The method takes an ObjectClass, a Uid, and any operation options.
component: openicf
page_id: openicf:connector-dev-guide:operations/operation-delete
canonical_url: https://docs.pingidentity.com/openicf/connector-dev-guide/operations/operation-delete.html
section_ids:
  DeleteApiOp-api-level-rules: Use the ICF delete operation
  DeleteOp-spi-level-rules: Implement the delete operation
---

# Delete operation

The delete operation interface enables the connector to delete an object on the target system. The operation includes one method (`delete()`). The method takes an `ObjectClass`, a `Uid`, and any operation options.

The connector should call the native delete methods to remove the object, specified by its unique ID.

## Use the ICF delete operation

The following exceptions are thrown by the Delete API operation:

* `UnknownUidException` - the UID does not exist on the resource

Consumption of the Delete Operation, at the API Level

```java
@Test
public void deleteTest() {
    logger.info("Running Delete Test");
    final ConnectorFacade facade = createConnectorFacade(BasicConnector.class, null);
    final OperationOptionsBuilder builder = new OperationOptionsBuilder();
    facade.delete(ObjectClass.ACCOUNT, new Uid("username"), builder.build());
}
```

## Implement the delete operation

Implementation of the Delete Operation, at the SPI Level

```java
public void delete(final ObjectClass objectClass, final Uid uid, final OperationOptions options) {
    if (ObjectClass.ACCOUNT.equals(objectClass) || ObjectClass.GROUP.equals(objectClass)) {
        // do real delete here
    } else {
        logger.warn("Delete of type {0} is not supported", configuration.getConnectorMessages()
                .format(objectClass.getDisplayNameKey(), objectClass.getObjectClassValue()));
        throw new UnsupportedOperationException("Delete of type"
                + objectClass.getObjectClassValue() + " is not supported");
    }
}
```
