Deleting a resource

All resources have DELETE available through HTTP. Any client can make that request and the server responds appropriately. This client makes DELETE available on ‘self’ links. The server may have implemented an OPTIONS approach but this case we haven’t implemented this on the current client.

delete resource

Some general rules about try DELETE

  1. try DELETE using ‘self’ on any/all resources (so that there is cache invalidation on the correct URI)
  2. DELETE on a singleton should just work (and invalidate caches because of rule 1)
  3. DELETE on a collection item just should work particularly because it should not have side effects (and invalidate caches because of rule 1)
  4. DELETE on a collection usually fails because the collection needs to empty so that collection items don’t have cache poisoning (which means following rule 3 first but then it is an empty collection and unlikely to be ‘deleted’)

Please note that APIs that implement batch delete are likely to break these rules—we may look to implement ‘batching’ from a user perspective because that is a good user experience but still implement it as per those rules in the client implementation. What is that rule about types of optimisation as the root of problems?

Next Chapter

Displaying forms

Learn how to process form values for create and edit forms

Go to next chapter