Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Is Delete action idempotent?

 
Ranch Hand
Posts: 1759
12
  • 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.
 
Rancher
Posts: 43011
76
  • 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.
 
Marshal
Posts: 67289
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
 
Men call me Jim. Women look past me to this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!