/rest-patch-sample

Sample project for RESTful services with HTTP PATCH variants

Primary LanguageGroovyMIT LicenseMIT

RESTful service sample with HTTP PATCH

The intention of this project is to experiment with RFC7386 (JSON Merge Patch) and RFC 6902 (JSON Patch) implementations. None of the implemented variants are meant to be best or good practices.

Run tests

./gradlew clean test

Run application

./gradlew bootRun

Use application

Please find some HTTP PATCH example calls for the three different endpoints. HTTPie is used to call the API. Therefore, you need to install it, if you want to use the commands below directly in your terminal.

There is also a Postman collection in /doc folder.

JSON MERGE PATCH - V1

 http PATCH :10000/v1/persons/1 name="Test Name" Content-Type:application/merge-patch+json

JSON MERGE PATCH - V2

 http PATCH :10000/v2/persons/1 name="Test Name" Content-Type:application/merge-patch+json

JSON PATCH - V3

 echo '[{ "op": "replace", "path": "/name", "value": "Test Name" }]' | http PATCH :10000/v3/persons/1 Content-Type:application/json-patch+json

Continuous Integration

Used components / technologies