Unify and manage your data

Delete Entities by Entity Type

Learn how to delete all entities of a specified type from a tenant.

Use the Delete entities by entity type task to delete all entities of a specified type from a tenant.

The Delete entities by entity type task performs a full scan of the primary data storage and does not validate consistency with Elasticsearch indexes. As a result, recently deleted entities may temporarily appear in search results. This task is not intended to run in distributed mode. For large-scale deletions or distributed processing, consider using Bulk Delete Entities.

The Delete entities by entity type task does not wait for all events to be processed. Therefore, after this task is executed, some entities might still appear in search results. You might need to wait until Elasticsearch becomes consistent with the primary data storage.

Before you run the Delete entities by entity type task, run the Cassandra ES Consistency task to ensure that the Elasticsearch storage is in a consistent state with the main data storage. For more information, see Cassandra ES Consistency Task.

HTTP method and endpoint

Use the following HTTP method and endpoint path to submit the request to delete all entities of the specified type.

DELETE {TenantURL}/entities

Query parameters

The following table describes the query parameters and their values. A query parameter is a key-value pair added to the end of a URL to modify or refine a request.

ParameterTypeRequiredDescriptionAccepted values / Default
entityTypeStringYesThe entity type name. All entities of the specified type are deleted.Entity type name.
modeStringNoIndicates whether entities of the specified type are completely removed from the system or only flagged as deleted.soft or hard. Default: soft. soft marks the entity as deleted, but all data remains in the data storage. hard retains entity data such as entity ID, version, and date fields, and removes other data such as crosswalks and attributes from the data storage. Entities that only have the soft mode enabled are also removed.

Request headers

The following request headers must be included.

HeaderValueRequired
AuthorizationBearer <accessToken>Yes

For more information, see Authentication API.

Request body

This operation does not require a request body.

Example request

Use the following example to see how a complete request is structured with headers.

DELETE {TenantURL}/entities?entityType=HCP
Headers: Authorization: Bearer {your-access-token}

Response body

The following table describes the fields returned in the response body.

ParameterTypeDescription
numberOfProcessedObjectsNumberNumber of deleted entities since the task started.
objectsFailedToDeleteCountNumberNumber of objects that were not deleted.
objectsFailedToDeleteArrayEntity IDs that were not deleted. Only 100 entity IDs that were not deleted are displayed.
nameStringName of the manual task in the following format: <Hard/Soft> Delete Entities By Type: <entity type URI>.
startedTimeTime when the task started.
throughputNumberCurrent speed of the task, which is the number of entities deleted per second.
tenantStringName of the tenant.
currentTimeCurrent system time.

Example response

The following example shows a response with the launched task details.

{
    "id": "f3d47316-c249-4e60-9a8a-8e97cc9ca0e3",
    ...
    "parameters": {
        "tenantId": "jondoe",
        "entityType": "HCP",
        "mode": "hard"
    },
    "currentState": {
        "objectsFailedToDelete": [
            "1AlLNjPS",
            "8C06vMB"
        ],
        "entityType": "configuration/entityTypes/HCP",
        "lastExecutionEC2Instances": "i-{instance-id}",
        "objectsFailedToDeleteCount": 2,
        "numberOfFailedToPublishEvents": 0,
        "lastHourThroughput": 0.0,
        "numberOfProcessedObjects": 126,
        "status": "Completed"
    },
    "throughput": 9.692307,
    "duration": "13s"
}

Check task status

Use the following request to see the status of the task:

GET /tasks

This request returns task information in the same format. When the task is completed and all entities of the specified type are deleted, the task information is no longer returned in the response.

To see completed task information, use the following request:

GET /tasks/history