Skip to main content

Install MongoDB

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/film \
--header 'Content-Profile: sakila' \
--header 'Content-Type: application/json' \
--header 'User-Agent: insomnia/8.4.5'

HTTP Response

TODO

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/9tigerio/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"
}

TODO - add more error scenarios.