• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Why PUT is idempotent ?

 
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

In HFSJ book the authors say that GET, HEADER and PUT are idempotent.

I'm really aware regarding the GET and HEAD methods but why PUT is also idempotent ?

I think I must first understand what's the PUT purpose.

As per my understanding, PUT is used to literally put some file on the server. Is it correct ?

If PUT is idempotent, is DELETE as well ?

Could you please explain which are idempotent ?

GET : Idempotent
POST : Non-Idempotent
HEAD : Idempotent
PUT : Idempotent. Why ???
DELETE : I really don't know. I think it's not idempotent. Please explain.
TRACE : Idempotent
OPTIONS : Idempotent
CONNECT : I really don't know. I think it's idempotent. Please explain.

TIA,
Edisandro Bessa.
[ October 05, 2006: Message edited by: Edisandro Bessa ]
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Edisandro,

I think the mathematical definition of idempotence from wikipedia helps:
"A unary operation (i.e., a function), is idempotent if, whenever it is applied twice to any element, it gives the same result as if it were applied once."

If you put a file to the server, the file will only be there once, even if you perform the PUT more than once. => idempotent

Its the same with DELETE. If you have deleted a file on the server, a second delete will have the same result: Theres is no file with the name of the deleted one. => idempotent

If you send an order to an online-shop by using POST, a second POST will imply a second order, so the result is not the same. So the result is not the same. => not idempotent

All other methods are idempotent, too.

I hope, that helps.

Best regards

Holger
 
No matter. Try again. Fail again. Fail better. This time, do it with this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic