Sobes.tech
Junior — Middle

Which HTTP methods are considered idempotent from the perspective of the REST protocol?

sobes.tech AI

Answer from AI

HTTP methods considered idempotent in REST are those that, when executed multiple times with the same parameters, do not change the server's state after the first request. These methods include:

  • GET — retrieves a resource, does not change the state.
  • PUT — updates or creates a resource at a given URI, repeated requests lead to the same result.
  • DELETE — deletes a resource, repeated deletion of the same resource does not change the state (the resource is already deleted).
  • HEAD — similar to GET but without the response body, also idempotent.

The POST method is not considered idempotent, as it usually creates new resources or triggers operations with side effects on each call.