InterviewBuddy
All interview questions

What makes an API operation idempotent?

Beginner

Answer

Repeating an idempotent operation has the same intended effect on server state as performing it once. The responses do not need to be identical.

Explanation

Retries are common after network failures. For operations like payment creation, an idempotency key lets the server recognize retries and avoid duplicate effects.

Example

PUT /preferences/theme
{ "theme": "dark" }