Handling missing and null values in API updates
Prevent an integration from unintentionally clearing or replacing business data during updates.
Identify the intended change
Agree whether the integration should leave a field unchanged, replace its value or deliberately clear it. For example, a missing telephone number in a partial customer update might mean the source did not send a change, rather than that the stored number should be deleted.
Read the actual API contract
A missing property, an empty string and a null value are different representations, but the destination defines what each means. RFC 7396 gives null a removal meaning in JSON Merge Patch; do not assume every API using JSON or HTTP PATCH follows that format.
Map the business decision
Record which system owns the field, who can authorise a clear operation and how an ambiguous update is handled. Preserve an auditable reason where the business needs one, and avoid substituting a guessed value for missing information.
Test each case safely
Use fictional customer records and mocked responses to test an omitted property, a null, an empty value and a valid replacement. Check both systems after each case and confirm that an unintended clear is visible for review before enabling the connection.