DEV Community

Discussion on: Explain the difference between PATCH and PUT Like I'm Five

Collapse
 
nateous profile image
Nate

I like to think of most of the verbs being like street addresses. GET PUT PATCH DELETE. but the odd one out is POST. it's used to do something that might not have an address or never would.

GET /article/1
PUT /article/1 (could create or replace)
PATCH /article/1 (maybe it has to exist already?)
DELETE /article/1 (do we just ignore if it doesn't exist?)
POST /article/action (maybe I'm not using GUIDs and have to POST new articles instead of giving it the street address)

Most importantly it should make sense in your app how the verbs are used. Prefer to stick with common conventions, if they exist.