Jan 30, 2013 at 8:52 AM
The following request was raised over on Isis' forum:
>On Sat, Jan 26, 2013 at 6:14 PM, Mark Wood-Patrick><firstname.lastname@example.org>wrote:>>> Are there any plans for the Restful Objects API to support the patch http>> verb (aka upsert) there by saving a round trip?
> I would like to create a generic action which would take a list/map of fieldname value pairs and update those fields in the object or createthe object if the key does not exist. Throwing an exception if a specified field does not exist or the value
has the wrong type
So, I've been mulling on this.
The RO spec defines:
- PUT against an existing object http://~/objects/CUS/1234 to do a bulk update of that object, and
- POST against an existing object type http://~/objects/CUS to do a persist of a new object.
What is being asked for is, I think, to allow the PUT to automatically create the object if it does not exist? That sounds reasonable. We would need a way to distinguish between the autocreate feature, however (ie distinguish UPSERT vs UPDATE).
My proposal is:
- PATCH (new verb) against an existing object http://~/objects/CUS/1234 to do a bulk update of that object (ie what PUT does today), and
- PUT against an existing object http://~/objects/CUS/1234 does an upsert.
Can't see this is massively high priority, but it'd be nice to have an answer.