Sobes.tech
Senior

What is idempotency in the context of HTTP?

sobes.tech AI

Answer from AI

Idempotence in the context of HTTP means that repeated calls of the same HTTP request with the same parameters will not change the server's state after the first call. That is, regardless of how many times the client sends the request, the result will be the same, and the server will not create duplicates or make additional changes.

Example:

  • The GET method is usually idempotent: requesting a resource does not change its state.
  • The PUT method is idempotent: updating a resource with the same data multiple times results in the same outcome.
  • The POST method is not idempotent: each call can create a new resource.

This is important for reliability and repeatability of operations, especially in distributed systems and in case of network errors.