Skip to content

organisation API: fix HTTP PUT and add HTTP PATCH

Motivation:

By standard definition, the HTTP PUT request method creates a new resource or replaces a representation of the target resource with the request payload. Also, PUT is idempotent whereas POST is not.

Currently, the API implementation treat both PUT and POST in the same way. Hence, cerebrum is not following proper restful api protocol definition.

Modification:

  • reimplement the PUT http method to create a new resources or replace an existing one.
  • add PATCH http method to partially update an existing resouces. This is achieve by using json-patch to describe the changes in the request body, hence the patch http method will consume application/json-patch+json (see http://jsonpatch.com/ on what json-patch is all about and how to use it).

Result:

  • PUT request either create a new entry or replace an extisting one
  • PATCH method can be use to partially update exitsing resources.

Target: master Acked-by: Pull-request: #6

Merge request reports