DEV Community

Discussion on: Explain HTTP Verbs like I'm Five

Collapse
 
pratikaambani profile image
Pratik Ambani

It was quite easy to understand buddy, but what about patch?

Collapse
 
bgadrian profile image
Adrian B.G.

I never saw a REST implementation to differentiate the PATCH vs PUT. In most real world examples you will use only GET and POST, it's best for everyone to have fewer endpoints and commands. If the POST has an UUID then is an update (PATCH), and PUT you almost never want/need it, because you don't want to carry around the entire records,only the fields you are interested in.

In order to differentiate between the POST/PUT/PATCH you have to know the state of the record, and it's hard to do in a distributed system, in a app that the user can be logged in from multiple devices in the same time, etc etc.

Anyway I'll try to remix it

PATCH - new paint only on the part it was scratched
PUT - new paint on the entire toy, even if it had a small scratch. If you want to keep the "good" scratches that you are bond to (for melancholic reasons) you have to recreate them.

Thread Thread
 
pratikaambani profile image
Pratik Ambani

Simply awesome :)