I have an API that can update an entity that exists already. This entity can be manually updated through an interface also where the API exists.
My question is what is a good design pattern or architecture on how to update only certain fields the vendor may send via the API on the entity? I don't want to override fields with NULL or empty strings just because they didn't know those values when sending to the API, but the entity in the database may already have a value for that field.
This should also take into account if a vendor WANTS to reset a field to an empty string of some sort.
Entity API Model
ID
Name
TwitterHandle
Entity Database Model with Values
ID = 200
Name = Hello
TwitterHandle = @hello
Entity Request Model send to API with Values
ID = 200
Name = Hello2
This request should only update the name to Hello2 but leave TwitterHandle alone. However, in another request they can reset the TwitterHandle if something was sent with it (NULL, empty string)