GET, POST, PATCH, DELETE; What are we “doing” in HTTP?

christopher diercksen
2 min readApr 27, 2021

Taken at the most basic level, these are actions that our browser (client) is asking the server to perform. The naming convention is actually rather intuitive in this way:

Go get me today’s to-do list off the refrigerator.
Here’s tomorrow’s to-do list, go post it on the fridge.
Go find tomorrow’s to-do list and patch these changes over it.
Find yesterday’s to-do list and delete it from the fridge.

Digging into the nitty gritty of how this code is used isn’t all that far off!

If our refrigerator is our database, let’s imagine the server to be some guy name Frank whose greatest joy in life is changing what’s on the fridge. Our runner is our controller and we are the client.

GET:
A Get request is made by the Client to the Server, asking for a particular resource by specifying a URI (http://refrigerator.frank/to-do-list/today). The Server follows the URI’s path instructions, retrieves the data and responds, sending a representation of the requested data back to the Client. This doesn’t change any of the data, so it’s a super safe method.

POST:
A POST request is also made by the Client to the server, except this time it’s providing new resources to be created— usually as a subordinate to a resource that already exists. The server follows the parent URI path (http://refrigerator.frank/to-do-list), then creates this new resource within it (/to-do-list/tomorrow) and returns a confirmation.

PATCH:
A PATCH request is a powerful edit function. Again, the client is providing the server with a URI path to an existing resource (/to-do-list/tomorrow). The server finds the resource, and then creates a new version using only the modifications we tell it to, returning a confirmation. There’s been a lot of ink spilled about the dangers of the PATCH method out there, so use with caution!

DELETE:
A DELETE request is maybe the most self-explanatory of them all. The client provides the server with a URI path (/to-do-list/yesterday) to an existing resource it wants removed, the server does so and confirms.

--

--

christopher diercksen
0 Followers

Theater Director, Dramaturg, Producer, Improvisor, Artistic Director, Office Manager, Software Engineering Student. (He/They)