I want to implement the partial updates for my resource as i have large resource and want to update the partial information from it.I have gone through the following links but not
able to figure out whether to use HTTP POST or PATCH methods.
How to submit RESTful partial updates?
http://jacobian.org/writing/rest-worst-practices/
https://github.com/archiloque/rest-client/issues/79
http://tools.ietf.org/html/draft-dusseault-http-patch-16
http://greenbytes.de/tech/webdav/draft-dusseault-http-patch-06.html
http://jasonsirota.com/rest-partial-updates-use-post-put-or-patch
http://bitworking.org/news/296/How-To-Do-RESTful-Partial-Updates
https://github.com/dharmafly/jsonpatch.js
Please suggest any valid solution for this.
You should use method PATCH like described in RFC-7386 "json merge PATCH".
E.g. if you want to change value of "a" and removing "f" in resource like:
You can achive this by sending:
PATCH is to be used with a patch format, for document-level patching only (aka a diff on the actual representation). Its use for other purposes is dubious and debatable, and it's not clear that the method was designed for non-media-type uses.
In general a POST will be the right approach, but you may want to split your resource into multiple resources instead and modify those instead.
[Edited for clarity, as some don't read comments]
According to RFC5789 (http://tools.ietf.org/html/rfc5789), this is precisely what PATCH is for:
The distinction between PATCH and PUT is described as:
The limitations of POST are also described:
I would suggest you read the RFC and make up your own mind, but to me this seems fairly clear-cut - PATCH requests should be processed as partial updates. (NB they are NOT idempotent, unlike PUT.)
EDIT: as pointed out by Eugene in the comments, although PATCH requests are
"neither safe nor idempotent as defined by [RFC2616]"
, they can be made so: