What is idempotent method

Idempotent methods
An idempotent HTTP method is method that can be called many times without different outcomes. It has no additional effect if it is called more than once with the same input parameters, the result would be the same.

Consider the following examples:

a = 1;//Line 1 (Idempotent)
a++; //Line 2 (Not Idempotent)

The Line 1 is idempotent because no matter how many times we execute this
statement, a will always be 1.
The Line 2 is not idempotent because executing this everytimes will result in a
different outcome.

Overview of HTTP methods

idem

Note:-

  1. An operation is called idempotent if it will produce the same results when executed once or multiple times.
  2. POST is NOT idempotent and remaining http method(GETPUTDELETEHEADOPTIONS and TRACE) are idempotent.

One thought on “What is idempotent method

Leave a comment