I have a confusion, that we consider post non-idempotent. While we don't consider put non-idempotent. If allowed by the servers, put can change the
state of the server as well. So why put is not considered non-Idempotent?
"Idempotent" doesn't actually mean that it can't change the state - that's a common misuse of the word. It means that if the operation is made multiple times it has the same effect as making it just once. So, for example, if you have a POST request that creates a new record, then applying it twice will create two records. So that isn't idempotent.
The word for an operation that has no side effects is "nullipotent".
Ben Pheonix wrote:Doesn't put come under category of Post as well?
No. A PUT, executed with the same data, will have the exact same effect each time it is executed.
If you're "not looking" and a random number of PUTs occur, then how would you tell how many PUTs occurred while you had the blindfold on? You can't. Because the effect of executing 17 of the PUTs, or 17 million of them, has the exact same effect of executing one PUT.