Sobes.tech
Middle

Which methods are idempotent and which are not?

sobes.tech AI

Answer from AI

Idempotence is a property of an operation where multiple executions with the same parameters produce the same result as a single execution.

Idempotent HTTP methods:

  • GET — retrieves a resource, does not change the server state.
  • PUT — updates a resource, repeated execution with the same data does not change the result.
  • DELETE — deletes a resource, repeated deletion of the same resource will not change the state (if the resource is already deleted).
  • HEAD — similar to GET but without the body, is idempotent.

Non-idempotent methods:

  • POST — creates a resource or performs an operation, repeated calls may create duplicates or change the state.
  • PATCH — partial update, may be non-idempotent depending on implementation.

Example: if POST creates a new order, a repeated POST will create another order, while PUT with the same body will update the existing order without changing the result.

Which methods are idempotent and which are not? — QA… - sobes.tech