permaculture playing cards
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes Is Delete action idempotent? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "Is Delete action idempotent?" Watch "Is Delete action idempotent?" New topic

Is Delete action idempotent?

Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 1120
In MZ's notes, it says in RESTful service, "Delete" is defined to be idempotent meaning "multiple identical requests should have the same effect as a single request".
But I think deleting a resource for the first time return status = ok, but deleting the same resource for the second time, it will return status = Not found.
I believe delete is non-idempotent.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
It may be counter-intuitive, but DELETE is idempotent. The result of successive request to remove an object are the same - the object is deleted. The status returned to the client may be different, but the effect as far as the resource is concerned is the same.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

Most people think of idempotent as "doesn't change server state". And that's wrong.

It's more correct to think of it, as Ulf pointed out, as "has same effect each time" as pointed out in the quote.

The term "same effect" is meaningful here: the status code is not an effect.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Is Delete action idempotent?
It's not a secret anymore!