Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is Delete action idempotent?

 
Himai Minh
Ranch Hand
Posts: 1328
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic