Purge Data

Bulk Deletion of Resources or Relationships

The Purge API endpoint facilitates the bulk deletion of specified resources or relationships from a data source. This operation is ideal for cleanup tasks, ensuring that all data of a specific type is completely removed from the target collection.

Using the Purge Endpoint

A purge request specifies exactly what Data Source is the target of the operation, including the type and key of the contained collection to remove all data.

{
    "collectionType": "<type>", // "resources" or "relationships" based on what is targeted
    "collectionKey": "<key>"
}

To delete all "providers" contained in a collection, the payload would look like:

{
    "collectionType": "resources",
    "collectionKey": "provider"
}

For more details, see:Create Purge Operation

Purge Status

Once a purge operation is initiated, the system responds with a unique identifier (purgeId) and details about the operation’s progress:

{
    "purgeId": "<id>", // Id of the purge operation.
    "collectionType": "<type>", // "resources" or "relationships" based on what is targeted
    "collectionKey": "<key>",
    "status": "<status>", // Status of the purge operation ("SUCCESS", "PENDING" or "FAILURE")
    "deletedCount": 0, // Number of items affected by the purge operation
    "createdAt": "2023-12-12T15:30:10.0000Z",
    "updatedAt": "2023-12-12T15:31:10.0000Z"
}

You can use the purgeId to retrieve the status of an ongoing operation, similar to bulk operation monitoring.

When the status is "SUCCESS", the specified elements have been deleted from the registry, additionally, the system ensures eventual consistency at the partition level. This means that while the data has been purged from the data sources, there may be a delay before the changes propagate across all partitions referring to it.

For more details, refer to the:Using the Purge Status

Notes

  • Target the Correct Data Source:
    Ensure the collectionKey accurately identifies the intended collection within the data source to avoid unintentional deletions.
  • UsecollectionType to Differentiate Targets:
    • "resources": Targets resources like "provider" or "office".
    • "relationships": Targets relationships such as "provider-office".
  • Best Practices for Safe Purging:
    • Review all inputs before initiating a purge.
    • Use status monitoring (purgeId) to confirm successful execution or handle errors.

❗️

Warning - Deletion Propagation:

The purge operation use cascading effect. If a resources is deleted, all it's attached relationships will also be deleted.

This is not the case for relationships. Deleting relationships will not affect their referred resources.