Accelerate the Value of Data

Delete Entities by Entity Type

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

This Delete entities by entity type operation deletes all entities of a specified type from a tenant. Before you run this 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 topic Cassandra Es Consistency Task.

Note: The Delete entities by entity type task does not wait for all events to be processed. Therefore, after this task is executed, it is possible that some of the entities are available when you search for it. You have to wait for some time before the Elastic Search is consistent with the main data storage.

Request

DELETE {TenantURL}/entities
Table 1. Parameters
Parameter Required Details
Headers Authorization Yes The information about authentication access token in format "Bearer <accessToken>". For more information, see topic Authentication API.
Query entityType Yes The entity type name. All entities of the specified type are deleted.
mode No An optional parameter indicating whether entities of the specified entity type are completely removed from the system or the entities are only flagged as deleted. Possible parameter values are:
  • soft (default) - the entity is marked as deleted but all data remains in the data storage (you cannot see or restore the entity).
  • hard - entity data such as entity ID, version, and date fields are retained and all other data such as crosswalks and attributes are removed from the date storage.
    Note: Entities that only have the soft parameter mode enabled are also removed.

Response

JSON Object representing information about launched manual task which will delete all entities of the specified type:

  • numberOfProcessedObjects- number of deleted entities since the task started.
  • objectsFailedToDeleteCount- number of objects that were not deleted.
  • objectsFailedToDelete- entity IDs that were not deleted (only 100 entity IDs that were not deleted are displayed).
  • name- name of the manual task in the following format: "<Hard/Soft> Delete Entities By Type: <entity type URI>".
  • started- time when the task started.
  • throughput- current speed of the task (number of entities deleted per second).
  • tenant- name of the tenant.
  • current- current system time.

To see the status of the task, use the following request:

GET /tasks 

This request returns the information about the task in the same format. When the task is completed and all entities of the specified type are deleted, you will no longer see the task information in the response. To see the task information, use the following request:

GET /tasks/history

Request

DELETE {TenantURL}/entities?entityType=HCPHeaders: Authorization: Bearer
            204938ca-2cf7-44b0-b11a-1b4c59984512 

Response

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