DigitalState microservice implement a "soft-delete" functionality which ensures that only users with the appropriate permissions can permanently purge data from a microservice's database.
With a few exceptions, whenever a DELETE method is actioned, a soft-delete occurs.
By default, all GET methods return non-deleted content even when not using the deleted=false query param.
Query Param: deleted
Possible values:
null
: (literal word) Returns all entities, whether they have been deleted or not.false
: Returns entities that are not deleted.true
: Returns entities that have been deleted.
See the DigitalState Postman Collection in the SDK Repo for further examples of the deleted
query param.
Each entity that has soft-delete enabled, implements a property named deletedAt
, which tracks the timestamp of when that database record was deleted.
In order to un-delete soft-deleted content, you will need to issue a PATCH request to the entity with "deletedAt": null
.
By default, when creating a new entity, the deletedAt
column will be null. In other words, a non-deleted content.
When issuing a DELETE request to an entity with soft-delete enabled, the row will remain in storage, however, the deletedAt
property will be updated with the current timestamp. The entity will be then considered soft-deleted.
Entities that has soft-delete enabled cannot be deleted outright from storage at the moment. See ticket.
- What happens when you issue a GET request on soft-deleted item(s)? Do i have to apply the query param to access it?
By default, only non-deleted items are returned. If the query param
deleted
is provided, then the expected behavior is as below:
null
: (literal word) Returns all entities, whether they have been deleted or not.false
: Returns entities that are not deleted.true
: Returns entities that have been deleted.
-
Can I PATCH/PUT on a soft-deleted item? The item will get updated as normal. No additional parameters are needed.
-
Is there a data about who deleted it? At the moment, there is no data about who deleted it.
-
Is there data about who Un-deleted it? At the moment, there is no data about who un-deleted it.
-
Are there specific error messages about soft-deleted content? At the moment, there are no specific error messages about soft-deleted content.