DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk3 min

How Should a Client Management API Respond to a Stale Status Update?

Protect client status changes with ETag and If-Match: return 412 for a failed precondition, reserve 409 for other resource-state conflicts, and document a safe recovery path.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Reject a stale status update rather than silently overwriting newer data. When the request includes an If-Match condition and its entity tag no longer matches the current representation, return 412 Precondition Failed and do not apply the update. Reserve 409 Conflict for a conflicting resource state that is not simply a failed request precondition.

Why stale status updates need protection

A stale update occurs when two clients read the same client record, then one changes it before the other submits an update based on its older view. If the API accepts the later update blindly, it can overwrite the first client’s work—a lost update. HTTP conditional requests are designed to prevent that outcome. RFC 9110, published June 2022, describes using conditions with state-changing methods to avoid lost updates.

As an Amazon Associate I earn from qualifying purchases.

Use ETag and If-Match for optimistic concurrency

Return an ETag with the client representation, and require the client to send that value in If-Match when it changes the status. The server compares the supplied validator with the current representation before performing the update. For If-Match, RFC 9110 requires strong entity-tag comparison; a weak ETag does not provide this protection against changes to representation data.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For example, a client might retrieve a record and receive an ETag, then submit its status change with an If-Match header containing that tag. The specific URI, representation format, and status values depend on the API; the key is that the update is conditional on the version the client actually read.

Choose 412 or 409 based on what failed

Situation Response and behavior Specification basis
The request has If-Match, but no current strong entity tag matches. Return 412 Precondition Failed; do not apply the update. RFC 9110 requires the server not to perform the method when the condition is false. It permits a 2xx response only when the server can determine that the same requested state-changing operation already succeeded.
A PATCH encounters a conflict and the request’s If-Match or If-Unmodified-Since condition failed. Return 412 Precondition Failed to identify the failed precondition. RFC 5789, published March 2010, distinguishes failed preconditions from other conflicts.
A PATCH cannot be applied because its assumed resource structure or state conflicts, and the request supplied no precondition. 409 Conflict can signal the conflict. RFC 5789.
PATCH operations must be processed in order, but the server cannot queue concurrent updates. 409 Conflict can indicate the concurrent-modification condition. RFC 5789.

In short, use 412 when a supplied precondition is false; use 409 when the resource state prevents the requested patch for another reason. RFC 5789 says 412 is most helpful when the client supplied a precondition and it failed.

Make validation and the write atomic

Checking the ETag and then writing in separate, unprotected steps can leave a gap for another update to land after validation but before the write. The API’s storage layer should make the version check and update atomic, so the server can honor the rule that it must evaluate the precondition before performing the method. The RFCs define HTTP behavior; they do not prescribe a particular database transaction or storage design.

Give clients a safe recovery path

  1. On 412, leave the resource unchanged. The response should say that the update was not applied because the representation changed.
  2. Retrieve the current representation. After a failed PATCH, RFC 5789 says the client can issue GET to inspect the resource’s state.
  3. Reconcile the intended status change. Compare the current state with the client’s intended change. How to merge changes or decide whether the transition remains valid is an application-specific policy, not defined by these RFCs.
  4. Retry conditionally. If the change is still appropriate, submit a new update using the current ETag in If-Match.

Document the API’s error-body format and recovery workflow: neither is standardized by the cited RFCs. A bare update without a validator cannot establish that the client’s view was current. RFC 5789 recommends conditional requests when a patch format depends on a known base point.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Do not replay a transition against newer state by default

A failed precondition should not become an automatic status change against whatever state happens to be current. The narrow case for a 2xx response is when the server can determine that the same state-changing operation already succeeded. Treating other failed preconditions as success can be risky, particularly when transitions are not atomic or other writers do not cooperate.

Quick Recap

Bestseller No. 3
API 5-in-1 Test Strips Freshwater and Saltwater Aquarium Test Strips 25-Count Box
API 5-in-1 Test Strips Freshwater and Saltwater Aquarium Test Strips 25-Count Box
Dip test strips into aquarium water and check colors for fast and accurate results; Helps prevent invisible water problems that can be harmful to fish and cause fish loss
$12.98
Rank #3
API 5-in-1 Test Strips Freshwater and Saltwater Aquarium Test Strips 25-Count Box
  • Contains one (1) API 5-IN-1 TEST STRIPS Freshwater and Saltwater Aquarium Test Strips 25-Count Box
  • Monitors levels of pH, nitrite, nitrate carbonate and general water hardness in freshwater and saltwater aquariums
  • Dip test strips into aquarium water and check colors for fast and accurate results
  • Helps prevent invisible water problems that can be harmful to fish and cause fish loss
  • Use for weekly monitoring and when water or fish problems appear

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.