You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@syncope.apache.org by Francesco Chicchiriccò <il...@apache.org> on 2015/09/16 08:34:45 UTC
Further REST enhancements for 2.0.0
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 and the latter,
inspired by OData, for providing attribute-based operations.
WDYT?
--
Francesco Chicchiriccò
Tirasa - Open Source Excellence
http://www.tirasa.net/
Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/
Re: Further REST enhancements for 2.0.0
Posted by Francesco Chicchiriccò <il...@apache.org>.
Hi all,
FYI I've just completed the implementation of features described below.
Regards.
On 16/09/2015 14:31, Sergey Beryozkin wrote:
> Hi Francesco
> On 16/09/15 13:27, Francesco Chicchiriccò wrote:
>> On 16/09/2015 14:04, Sergey Beryozkin wrote:
>>> 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.
>>
>> Correct: we're still using POST for create new users (groups, any
>> objects).
>>
> OK
>>> 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.
>>
>> I also know from my own experience that PATCH is more troublesome, but
>> it's also true that it has been set as standard since quite a long time,
>> and this should sets expectations for it to eventually succeed.
>>
> Sure
>>> Perhaps in the short term it makes sense to support both PUT and PATCH
>>> for updates.
>>
>> Agree: and it is an enhancement anyway since currently we only provide
>> POST for updates (for users, groups and any objects, the remaining
>> services are already on PUT).
>>
>>>> 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)
>>
>> The capitalized stuff comes from the SchemaType enum [1] and is already
>> used in different resources throughout all the Syncope services.
>> Do you think it would make sense to lowercase it?
>>
> I only commented on it because typically target URI are in lower case
> but if it is already used as 'PLAIN'/etc then it is perfectly
> acceptable too
>
> Thanks, Sergey
>> Regards.
>>
>> [1]
>> https://github.com/apache/syncope/blob/master/common/lib/src/main/java/org/apache/syncope/common/lib/types/SchemaType.java
Re: Further REST enhancements for 2.0.0
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Francesco
On 16/09/15 13:27, Francesco Chicchiriccò wrote:
> On 16/09/2015 14:04, Sergey Beryozkin wrote:
>> 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.
>
> Correct: we're still using POST for create new users (groups, any objects).
>
OK
>> 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.
>
> I also know from my own experience that PATCH is more troublesome, but
> it's also true that it has been set as standard since quite a long time,
> and this should sets expectations for it to eventually succeed.
>
Sure
>> Perhaps in the short term it makes sense to support both PUT and PATCH
>> for updates.
>
> Agree: and it is an enhancement anyway since currently we only provide
> POST for updates (for users, groups and any objects, the remaining
> services are already on PUT).
>
>>> 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)
>
> The capitalized stuff comes from the SchemaType enum [1] and is already
> used in different resources throughout all the Syncope services.
> Do you think it would make sense to lowercase it?
>
I only commented on it because typically target URI are in lower case
but if it is already used as 'PLAIN'/etc then it is perfectly acceptable too
Thanks, Sergey
> Regards.
>
> [1]
> https://github.com/apache/syncope/blob/master/common/lib/src/main/java/org/apache/syncope/common/lib/types/SchemaType.java
>
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Re: Further REST enhancements for 2.0.0
Posted by Francesco Chicchiriccò <il...@apache.org>.
On 16/09/2015 14:04, Sergey Beryozkin wrote:
> 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.
Correct: we're still using POST for create new users (groups, any objects).
> 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.
I also know from my own experience that PATCH is more troublesome, but
it's also true that it has been set as standard since quite a long time,
and this should sets expectations for it to eventually succeed.
> Perhaps in the short term it makes sense to support both PUT and PATCH
> for updates.
Agree: and it is an enhancement anyway since currently we only provide
POST for updates (for users, groups and any objects, the remaining
services are already on PUT).
>> 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)
The capitalized stuff comes from the SchemaType enum [1] and is already
used in different resources throughout all the Syncope services.
Do you think it would make sense to lowercase it?
Regards.
[1]
https://github.com/apache/syncope/blob/master/common/lib/src/main/java/org/apache/syncope/common/lib/types/SchemaType.java
--
Francesco Chicchiriccò
Tirasa - Open Source Excellence
http://www.tirasa.net/
Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/
Re: Further REST enhancements for 2.0.0
Posted by Sergey Beryozkin <sb...@gmail.com>.
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?
>