This project is read-only.

RESTful best practices

Topics: Web Api
Mar 16, 2011 at 4:07 PM

Looking for some best practices when dealing with data during a PUT (Update).  If this is the incorrect place/forum, please point me to some discussion groups.

Consider a Customer object with an ID, Name.First, Name.Last, Address.Street, Address.Apartment, Address.City, etc

With RESTful services, it's not necessary for the user to supply the entire object, so they could essentially supply:

In our environment, we are calling existing services that use datasets/datatables. So, first we have to convert the POCO object into a datarow.  It would look something like:
custRow.Id = pocoCust.Id;
custRow.LastName = pocoCust.LastName;
custRow.FirstName = pocoCust.FirstName;

Oops!!  But pocoCust.FirstName is null or empty string.  It looks like we should just update the last name.  But should we?  Consider the change is an address.  The person moves from an apartment to a house and now they don't have an apartment number anymore.  How do you distinguish "it should be blank" from "it wasn't supplied"?

Thanks in advance for any help you can provide.