API design · Fill in the blank

To stop two clients from overwriting each other's edits, the server returns an blank with the resource, and the client sends it back in an blank header when updating. A stale value gets blank.

hard Consistency

Answer

To stop two clients from overwriting each other's edits, the server returns an ETag with the resource, and the client sends it back in an If-Match header when updating. A stale value gets 412.

Also accepted: 412 Precondition Failed, Precondition Failed for 412.

Why

This is optimistic concurrency over HTTP: no locks are held, and the loser re-reads the resource and retries its change.

Review this in your daily deck All cards in API design