Skip to main content

Delete All Records

DB2Rest allows deletion of multiple/all records from a database table using HTTP DELETE method.

warning

If the parameter - ALLOW_SAFE_DELETE is set to true, then this operation will fail with an error.

Example Request

curl --request DELETE \
--url http://localhost:8080/v1/rdbms/db/film \
--header 'Content-Profile: sakila' \
--header 'Content-Type: application/json' \
--header 'User-Agent: insomnia/8.4.5'

Error handling

If delete operation is attempted when ALLOW_SAFE_DELETE is set to false, it will result in error as shown below in the response payload.

{
"type": "https://github.com/kdhrubo/db2rest/delete-bad-request",
"title": "Delete Operation Not allowed",
"status": 400,
"detail": "Invalid delete operation , safe set to true",
"instance": "/film",
"errorCategory": "Delete-Error",
"timestamp": "2023-12-26T08:19:43.232283Z"
}