A business services company's PATCH endpoint began deserializing requests into a full entity and saving defaults for omitted fields. A mobile client changing only a phone number unintentionally cleared billing preferences, notification settings, and secondary contact information.
What happened
A business services company exposed a customer profile API used by its sales portal, mobile application, and partner integrations. The API documentation described PATCH /customers/{id} as a partial-update operation: consumers could send only the fields they wanted to change.
During a routine backend refactoring, the implementation began deserializing the incoming body into a full customer object and passing it to a repository save operation. Fields omitted from the request were populated with defaults or null values. A mobile client that sent only a changed phone number therefore unintentionally cleared the customer’s billing preferences, notification settings, and secondary contact information.
The service returned 200 OK and the response showed the new phone number, so ordinary endpoint tests passed. The damage was discovered when customer-support agents noticed missing preferences and partner systems received incomplete profiles. A separate client used PUT as if it meant partial update, creating the opposite problem: it assumed omitted fields would be preserved.
Root cause
The post-incident review found that tests validated the happy-path response but did not verify method semantics or inspect the complete persisted resource after an update. The team introduced explicit PUT replacement behavior, PATCH field-presence handling, and concurrency checks. Contract tests now verify that omitted fields remain unchanged for PATCH, while PUT replaces the representation according to the documented contract.
The fix
The team replaced entity binding with explicit request DTOs and field-level write policies. PATCH now merges only the fields explicitly present in the body, while PUT performs full replacement.
Testing gaps and preventive tests
Partial-update tests, explicit-null tests, full-replacement tests, and concurrent-update tests using ETags or version numbers must all be part of the test suite. Tests must compare PUT and PATCH semantics and check persisted state beyond the submitted field.
Business impact
Customer preferences were silently lost, support workload increased, and partner synchronization had to be replayed.
Lesson learned
HTTP methods are part of the API contract. A successful status code does not prove the requested operation had the intended scope.