ADR: Bulk delete storage api
Business Driver
To enable an acceptably succinct and non-chatty interface for deletion of records, a bulk delete capability in the Storage API is needed. The primary business driver is to allow client applications to delete chunks of records that 1) may be the complete list of a entity parent-child or relationship tree, e.g. well->wellbore->logset->logs and that would be painful and poorly performant to call individually or 2) a list of mistakenly modified or created records as part of an ingestion or 3) a simple clean-up involving records created for testing.
The new endpoint should do soft delete (do the same what does /records/{id}:delete
) for multiple records.
New API endpoint:POST /records/delete
As a body it should receive JSON array of string record ids e.g. :
[
"opendes:welldb:123456",
"opendes:welldb:123457",
"opendes:welldb:123458"
]
Response :
If deleted status was set for all records successfully then 204 response code should be return without body.
If some of the records weren't updated because of some reason, 207 status code should be returned wiyth body e.g:
{
notDeletedRecords : [
"opendes:welldb:111111",
"opendes:welldb:111112"
]
}
Expected API specification:
"/records/delete":
post:
tags:
- records
summary: Soft delete of multiple records
description: "The API performs a soft deletion of the given list of records. Required roles: 'users.datalake.editors' or
'users.datalake.admins'."
operationId: Delete records
parameters:
- name: data-partition-id
in: header
description: This value should be the desired data partition id.
required: true
schema:
type: string
default: opendes
requestBody:
content:
application/json:
schema:
type: array
items: string
responses:
"204":
description: All records deleted successfully.
"207":
description: Some of the records weren't deleted successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/DeletedRecordResponse"
DeletedRecordResponse:
type: object
properties:
notDeletedRecords:
type: array
items:
type: string
example: opendes:welldb:123456
description: List of record ids which weren't deleted successfully.
description: Delete Records Response Body