Invoking APIs‎ > ‎

DELETE

You can delete objects by primary key or in batch. To delete by primary key, include the key as the last URL node, and include the checksum, for example:

http://localhost:8080/APIServer/rest/el-local/demo/v1/demo:customer/New%20Customer?checksum=A:beb6d7c43e6c398f

The following image shows a DELETE call in the REST Lab:

(Advanced) Bypass Optimistic Locking

(Advanced) 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 parameter ignoredeleted. Normally, a DELETE on a non-existent resource results in a 404 - No such object error message. While this is correctly 'RESTful' and idempotent,  it may not be the wanted result. For these times, 'ignoredeleted' parameter may be added. The call will still be idempotent, but will return 200 with an empty txsummary.

This may be useful in data loading scenarios where old data (which may or may 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.  Use of the 'ignoredeleted' flag can make batch jobs simpler.

curl -X DELETE https://acme.server.com/rest/el-dev/demo/v1/demo:customer/Golf%20Industries?checksum=override&ignoredeleted

will return error level 0 when it successfully deletes AND when it does not exist.  It will return usually return 22 for other errors.

Delete in Batch

Deleting objects one at a time can be too slow. To delete multiple objects in one request, you can send those objects (actually, just their metadata section is required) with the DELETE action specified in the metadata section. For instance, 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"
    }
  }
]

Specifying the entire objects instead of just the metadata section does not hurt anything. It is not required.