PUT vs PATCH
A PUT request replaces the whole thing on the server with the full copy you send. A PATCH request changes only the fields you send. A PUT that leaves out a field may wipe it, while a PATCH leaves it alone.
PUT Request
A request that swaps the whole thing for the one you send.
A PUT request replaces a whole thing on the server with the version you send. You send every field, and whatever you leave out may be wiped. If the thing does not exist yet, some servers create it. Sending the same PUT twice leaves the same result as sending it once. That makes it safe to retry after a network error.
PATCH Request
A web request that changes only part of a thing. You send just the changes.
A PATCH request changes only part of a thing on the server. You send just the fields you want to change, and the rest stays as it was. That makes requests smaller than a PUT, which sends the whole thing. Whether sending the same PATCH twice is safe depends on how it is written. Setting a field is safe to repeat; adding one to a counter is not.
In one line
- PUT Request
- A request that swaps the whole thing for the one you send.
- PATCH Request
- A web request that changes only part of a thing. You send just the changes.