I’m developing a REST api, and I’m wondering the following:
I want to use HTTP PUT to update some entities in the webservice. The format will be a urlencoded body. Is it acceptable to only update the fields that were actually specified, rather than the entire entity?
I’m asking, because PUT would be a very convenient method to do some updates, but I don’t want them to remove fields if they just happened to misspell some of them. Additionally, I don’t want to force the implementor to always have to do a GET first and copy every single field they might not actually use..
Put is only for complete replacement. There is a proposal for the verb PATCH to address the problem you have (http://www.ietf.org/internet-drafts/draft-dusseault-http-patch-14.txt)
Patch, however, still may not be what you want. What is sent is an update resource that can do things like increment counters and so, unlike put, isn’t idempotent.
You could expose each field as a resource and do multiple puts to each field. You can pipeline the puts to mitigate the extra latency.