Updating Records
When updating a record, it’s important to understand how the provided values affect the data:
-
Fields set to null:
Behavior: If a field is set to null, the existing value for that field will remain unchanged.
Example: If a donor's current suffix is שליטא, and the request sets thesuffixHebrew
field to null, the suffix will not be removed or updated; it will stay as שליטא. -
Fields set to an empty string or empty array:
Behavior: If a field is set to an empty string or an empty array, the existing value will be deleted.
Example: If thetitle
is set to Mr. and a request is made with thetitle
set to an empty string, the title will now be an empty field. -
All other provided fields:
Behavior: Any other field that is provided with a value will update the existing value for that field.
Example: If the currentfirstName
is Dovid and the request provides a new value like Avi, the name will be updated to Avi. -
Handling Arrays of Objects:
Behavior: Fields within arrays (such as lists of
phones
,emails
, oraddresses
) will be updated based on a unique identifier for each object in the array, likephoneLabel
,addressLabel
, oremailLabel
.
Example: Phone objects will be updated based on the label provided in the request. If a label is missing from the request, the corresponding object will be deleted. If one out of five phone numbers on record needs to be deleted, the update request needs to contain the four phone objects that should be kept, the fifth being empty and therefore, deleted.noteIf the label is not present in the update, the entire corresponding object will be removed from the record.