[Openstack] [Glance] Using HTTP PATCH

Mark Nottingham mnot at mnot.net
Wed May 30 00:03:37 UTC 2012


On 25/05/2012, at 4:53 AM, David Lutterkort wrote:

> At the same time, the patch language requires that clients either track
> changes in this language (difficult if the client's internal
> representation is very different from the JSON representation on the
> wire) or be able to diff an old and new JSON object and generate a
> json-patch object.
> 
> Has anyone looked into making it easier for clients to produce
> json-patch objects ?

I think the common use case is going to be "change the foo property to 3" or "add x to the bar array". At least, that's how I'd see it happening in OpenStack.

If it is, doing so in json-patch is quite simple; you just specify the corresponding arguments (add, replace, etc.). I suppose a little utility library might make it easier (e.g., give it a JSON object and allow manipulating it with add, replace, etc. methods), but that's just some sugar on top.

BTW, whether we use PUT or PATCH, we should be using conditional requests w/ strong validators and 412/428 status codes as necessary.

Cheers,

P.S. Full disclosure: I've recently been asked to take over editing that draft and json-pointer, to push them to completion.


--
Mark Nottingham   http://www.mnot.net/







More information about the Openstack mailing list