<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hi<br class="">
<br class="">
We are currently using PATCH in the Poppy API to update existing resources. However, we have recently had some discussions on how this should have been implemented. <br class="">
<br class="">
I would like to get the advise of the Openstack Community and the API working group on how PATCH semantics should work.<br class="">
<br class="">
The following RFC documents [1][2] (and a blog post [3]) advise the using PATCH as the following:<br class="">
<br class="">
<br class="">
2.1. A Simple PATCH Example
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""> PATCH /file.txt HTTP/1.1</div>
<div class=""> Host: <a href="http://www.example.com" class="">www.example.com</a></div>
<div class=""> Content-Type: application/example</div>
<div class=""> If-Match: "e0023aa4e"</div>
<div class=""> Content-Length: 100</div>
<div class=""><br class="">
</div>
<div class=""> </div>
[
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>{ "op": "test", "path": "/a/b/c", "value": "foo" },</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>{ "op": "remove", "path": "/a/b/c" },</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>{ "op": "add", "path": "/a/b/c", "value": [ "foo", "bar" ] },</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>{ "op": "replace", "path": "/a/b/c", "value": 42 },</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>{ "op": "move", "from": "/a/b/c", "path": "/a/b/d" },</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>{ "op": "copy", "from": "/a/b/d", "path": "/a/b/e" }</div>
]<br class="">
<br class="">
<br class="">
<br class="">
Basically, the changes consist of an operation, the path in the json object to modify, and the new value.
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">The way we currently have it implemented is to submit just the changes, and the server applies the change to the resource. This means passing entire lists to change etc.</div>
<div class=""><br class="">
</div>
<div class="">I would like to hear some feedback from others on how PATCH should be implemented.</div>
<div class=""><br class="">
</div>
<div class="">Thanks</div>
<div class=""><br class="">
</div>
<div class="">Amit Gandhi</div>
<div class="">- Rackspace</div>
<div class=""><br class="">
<br class="">
<br class="">
[1] <a href="https://tools.ietf.org/html/rfc5789" class="">https://tools.ietf.org/html/rfc5789</a><br class="">
[2] <a href="http://tools.ietf.org/html/rfc6902" class="">http://tools.ietf.org/html/rfc6902</a><br class="">
[3] <a href="http://williamdurand.fr/2014/02/14/please-do-not-patch-like-an-idiot/" class="">http://williamdurand.fr/2014/02/14/please-do-not-patch-like-an-idiot/</a><br class="">
<br class="">
<br class="">
<br class="">
</div>
</body>
</html>