Understanding the differences between the PUT and the PATCH methods
The HTTP PUT
and PATCH
methods have different purposes. The HTTP PUT
method is meant to replace an entire resource. The HTTP PATCH
method is meant to apply a delta to an existing resource.
Our API is able to update a single field for an existing resource, and therefore, we provide an implementation for the PATCH
method. For example, we can use the PATCH
method to update an existing notification and set the value for its displayed_once
and displayed_times
fields to true
and 1
.
We don't want to use the PUT
method to update two fields because this method is meant to replace an entire notification. The PATCH
method is meant to apply a delta to an existing notification, and therefore, it is the appropriate method to just change the value of those two fields.