July 2017
Beginner to intermediate
358 pages
10h 54m
English
The PATCH verb is used to perform a partial update, for example, if we only wanted to update the name of our cat we could make a PATCH request only containing the details that we would like to change.
Request:
PATCH /v1/cats/12343 HTTP/1.1 Content-Type: application/json Content-Length: xxxx {"weight": 9}
Response:
HTTP/1.1 204 No Body Content-Type: application/json Content-Length: 0
In my experience PATCH updates are rarely used, the general convention is to use a PUT and to update the whole object, this not only makes the code easier to write but also makes an API which is simpler to understand.
Read now
Unlock full access