DELETE

DELETE
lac31
You can delete objects by primary key or in batch.
In this article:
 
 
Delete Objects By Primary Key
To delete by primary key, include the key as the last URL node, and include the 
checksum
 value, for example:
http://localhost:8080/APIServer/rest/el-local/demo/v1/demo:customer/New%20Customer?
checksum
=A:beb6d7c43e6c398f
You can test this DELETE call using the REST Lab.
For more information about the REST Lab, see Test your API Using the REST Lab 
(Advanced) Bypass Optimistic Locking
You can specify the 
checksum
 value as override. For example, the following is the resulting URL:
http://localhost:8080/APIServer/rest/el-local/demo/v1/demo:customer/New%20Customer?
checksum=override
Specifying the 
checksum
 value as override can be useful when reloading data but it bypasses optimistic locking. You can control the response when the resource is not found by adding the optional 
ignoredeleted
 parameter. Normally, a DELETE on a non-existent resource results in the following message:
404 - No such object error message
While this is correctly RESTful and idempotent, it might not be the result you want. The calls you make with the added 
ignoredeleted
 parameter are still idempotent, but they return 200 with an empty 
txsummary
 . This might be useful in data loading scenarios where old data (which might or might not exist) is to be deleted.
The cURL utility, has a 
--fail
 switch which returns an error level 22 when most 400 and 500 errors are encountered. Adding the 
ignoredeleted
 parameter can make batch jobs simpler.
The following code snippet returns error level 0 when it successfully deletes and when it does not exist:
curl -X DELETE https://acme.server.com/rest/el-dev/demo/v1/demo:customer/Golf%20Industries?checksum=override&ignoredeleted
This code typically returns 22 for other errors.
Delete in Batch
You can delete multiple objects in batch by deleting them in a single request. Send the objects (or just their metadata sections) by specifying the 
DELETE
 metadata action tag.
For example, the following PUT request deletes two objects:
[
{
"@metadata": {
"href": "https://my.acme.com/rest/acme/sales/v1/inv:product/103",
"checksum": "A:92ac57ba5ac2e586",
"action":"DELETE"
}
},
{
"@metadata": {
"href": "https://my.acme.com/rest/acme/sales/v1/inv:product/104",
"checksum": "A:0adfc9bf089177a1",
"action":"DELETE"
}
}
]