Learn More
The Id
Field
There are three possible behaviors regarding the Id
field when creating or updating a record:
Field Value | Outcome |
---|---|
Id is omitted | A new record will be created, and a new ID will be returned. |
A valid Id is provided | The existing record matching the ID will be updated. |
The provided Id does not exist | A new record will be created using the given ID. |
Updating a Record
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: If there are multiple phone numbers stored for a user, each with a uniquephoneLabel
, the correct phone 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.
Additional Rule: If the label is not present in the update, the entire corresponding object (such as the phone number) will be removed from the record.