In this lesson the CRUD model is translated in the HTTP commands POST, GET, PUT and DELETE:
Note that the description for PUT command states that it is used to update a specific resource by its id.
In the CRUD article, regarding PUT there’s this example:
Now, reading on different materials I noticed that the HTTP PATCH command is considered part of the UPDATE process of the CRUD model, maybe even more closely than PUT.
MDN states for example:
While on the page regarding PUT a similar statement is not present.
Still on MDN and also on other resources (e.g.: ietf.org or rapidAPI) PUT is explicitly deemed as a command to be used only when the entire resource must be changed, if it exist, or created if it doesn’t exist (acting like a POST). But in any other case the PATCH command should be used.
Hence, in the example above, the one used in the CRUD article to explain the PUT command, the logic expressed is to overwrite the entire resource at
id: 1223 only to update the price of the dish from 8 to 10.
I believe this is the wrong approach and a PATCH should have been considered instead. But I’m still learning about this so I may be missing something.
Does anybody know why there’s no info on what is PATCH and when it should be used instead of PUT?