Hi Francesco, All
Please see comments below
On 16/09/15 07:34, Francesco Chicchiriccò wrote:
Hi all,
I have just opened SYNCOPE-694 and SYNCOPE-695 for providing further
enhancements to REST interface: the former for (long-overdue) turning
POST-based updates into more compliant PATCH and PUT
Updating individual resources with POST is indeed not very compliant,
thought I guess if it is a case of adding a new collection member (ex,
adding new user to a collection of users) then one may qualify that as a
process of updating the collection, while adding a new collection
resource. I'd probably keep POST for that case but I'm presuming the
main idea is to switch to PATCH/PUT when updating the existing
non-collection resource.
One point about PATCH - it is obviously more effective to do a partial
update (ex, 1 individual resource attribute) then the complete update
typically done with PUT when only one attribute has changed, with the
rest keeping the original values.
However I'm not sure if using PUT for partial updates is wrong. The
partial update is always application specific, but overall it is still
an update. Similarly, would it be wrong to use PATCH for a complete
update instead of PUT ? I'm not sure either.
I'm not discouraging you to use PATCH :-). I know quite a few users are
interested in marking the finer-grained updates with PATCH. Only please
be aware that not all client support PATCH well, particularly
HttpUrlConnection-based, though as it happens we can have PATCH
supported with HttpUrlConnection in CXF now - but only due to some
reflection magic Dan did.
Perhaps in the short term it makes sense to support both PUT and PATCH
for updates.
and the latter,
inspired by OData, for providing attribute-based operations.
Sure - sounds like a great idea, may be it makes sense to keep path
segments uncapitalized ('plain' vs 'PLAIN', etc)
Thanks, Sergey
WDYT?