Delete

You can delete objects in one of two ways:
  • by primary key
  • in batch

To delete by primary key, include the key as the last URL node, and include the checksum, as shown below:

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


Advanced Features:
The checksum value may be specified as 'override' so the resulting URL would be

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

This not generally recommended as it bypasses optimistic locking, but can be very useful when reloading data.

The optional parameter 'ignoredeleted' can be added to control the response when the resource is not found. 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.

Deleting 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 will delete 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's just not required.