Hey there, the objective of this story format is to be fast and tell you fundamentals where we sometimes don't question ourselves in our daily lives.
So, let's create a scenario where you have an e-commerce and one endpoint is responsible for creating a product.
After creating a new product. We noticed that the price was wrong. The normal first thing is to have an endpoint to "update" the whole entity by passing the ID.
Normally this is a common situation. Some developers would say that PUT is for updating, but it is not really, PUT is to replace completely or create.
Yeah, the product 111 could not exist and we could create it.
To improve this, we can use the PATCH verb, because we only want to change the price ok?
So the patch is to update individual fields of the existing resources.
We could do something like
If the product 111 doesn't exist we will get an error.
Of course in the PUT scenario, we can check if there is an entity before or depends on the way that we're implementing the database layer of our application we probably get an error too, but in theory is possible to create instead of return an error.
If you want to have an endpoint that only modifies individual fields according to RFC 5789 should use the PATCH verb.
If you want to have an endpoint to modify completely a resource we should use the PUT verb according to RFC 2616.