Question 140
An invoice agent reads an existing draft invoice and its current ETag, validates the quoted unit prices, then prepares an authorized PUT that finalizes the draft. Another service may change those prices after the read. The invoice API supports conditional writes. Which implementation prevents finalization with a stale price snapshot?
Explanation
Correct Answer
Microsoft Azure REST guidance uses a strong `If-Match` precondition on state-changing updates and returns HTTP 412 on a version mismatch; an atomic server-side check rejects stale writes until the agent fetches and revalidates current prices.
Incorrect Answers
A local check cannot prevent another writer changing the record between check and PUT; conditional enforcement must happen at the API server.
Read-time cache validation is not the conditional `If-Match` precondition needed to guard a later state-changing PUT against stale writes.
A time-of-check-to-time-of-use race remains possible until the server validates the ETag with the final mutation.