Skip to content

.tip

· one of the small things

PATCH bodies as application/merge-patch+json

Every API invents its own PATCH body, so clients have to guess whether a missing field means leave it alone or clear it. RFC 7396 already settled it: missing means leave it, null means delete the key, and the request says so with Content-Type: application/merge-patch+json.

{ "nickname": null, "timezone": "Europe/Istanbul" }

That clears the nickname, sets the timezone and leaves everything else alone. Arrays get replaced whole, so removing one tag means sending the full list. Once that's common, the collection deserves its own endpoint.

api-designhttp