liveBook · Manning

Idempotency

As explained in Automating API Delivery

Idempotency is the property of an operation whose repeated execution produces the same resulting server state as a single execution.

Idempotency means that repeating an operation produces the same resulting server state as executing it once. It prevents retries from applying duplicate state changes. section 5.2.5

Review an API operation by checking:

  • Whether the operation is naturally idempotent. section 5.2.5
  • Whether a non-idempotent operation that requires safe retries accepts an idempotency key to detect and handle duplicate requests. section 5.2.5
  • Whether the operation’s error responses and status codes represent important failure scenarios accurately. section 5.2.5

Retrying a payment request

A payment endpoint using POST is not naturally idempotent. Add an idempotency key so repeated submissions can be recognized and the payment is applied only once. section 5.2.5

How Automating API Delivery covers it

How deep it goes
Defines repeated execution, distinguishes HTTP verbs, and prescribes idempotency keys without detailing their implementation.
Examples
Uses a payment endpoint to illustrate why POST may require an idempotency key.
What it assumes
Assumes familiarity with API operations and HTTP methods while defining idempotency from its server-state effect.
What you can do after
Evaluate API operations and identify when an idempotency key is required for safe duplicate-request handling.
How it connects
Connects idempotency with HTTP methods, idempotency keys, duplicate requests, and API design review.

Also explained in

Compare how 17 books explain idempotency →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Automating API Delivery. The section links point to the parts of the book it draws on.