Difference between idempotent (GET, HEAD, etc) and NON idempotent(POST, PUT, etc.) ???
can anybody help me
Joined: Jul 20, 2005
My guess is that you are really asking what idempotent really means. www.dictionay.com -> idempotent
Acting as if used only once, even if used multiple times
What this really means is the methods GET, HEAD, etc should not make changes that will cause a second identical request (for the same user in the same session) to display different information, ie update the database.
Methods such as Post and PUT are not expected to be idempotent, that is two identical requests (from the same user in the same session) may result in different results being displayed to the user.
To put this another way adding an item to a shopping cart is not an idempotent request as it changes information curical to the user. Where as viewing the contents of the shopping cart should not change the contents of the shopping cart as it therefore an idempotent request.
Hope this helps
Joined: Jun 09, 2005
Joined: May 12, 2004
I read in the book, that POST was the only idempotent HTTP METHOD type.
I am not sure if PUT is also idempotent.
Joined: Jul 20, 2005
Not sure why I added Put - it is an idempotent method (or its supposed to be)
Logically speaking, all POST, PUT and DELETE should be idempotent, but from the perspective of the certification, possibly the book assumption should be correct.
PUT and DELETE could have effect, like putting a file or deleting a resource. The second time you do the same operation, it would possibly throw a warning that either resource is already present or not there.
Joined: Aug 02, 2005
Hello, Considering PUT and DELETE, reading the page Mat Williams mentioned make me think that the server should not warn the user if the file to be PUT is already there or the file to be DELETEd is not there anymore. It should be transparent because these methods are also considered idempotent.
I think that for GET and HEAD we have an agreement that they are idempotent. Request a HEAD the N-time for a file should have the exactly result that requesting the HEAD for the same file at the first time.
However, about POST, I don't agree with you. POST is not idempotent. For example, if you have a HTML Form for insert a person in the database. The first time you submit the form that record will be inserted in the database. The second time you submit the form you will get a duplicate key exception (or something like that). And we may find other similar examples. Regars, Alexandre