If URLs are the nouns of the web, HTTP Methods are the verbs. They provide the exact action to perform on the targeted resource.
1The Verbs of REST
We established that REST URLs should be strictly nouns (e.g., /users). So how does the server know what action to perform on that noun? This is the job of HTTP Methods (often called HTTP Verbs). By attaching a specific verb to the request, you explicitly tell the server whether you want to Read, Create, Update, or Delete the resource. This maps perfectly to the database concept of CRUD.
POST -> Create
GET -> Read
PUT -> Update
DELETE -> Delete
2GET: Reading Data
The GET method is used exclusively to request data from a specified resource. It is the most common HTTP method on the internet. Every time you type a URL into your browser and hit Enter, your browser performs a GET request under the hood. Crucially, GET requests are considered 'Safe' and 'Idempotent'. This means performing a GET request should NEVER alter or mutate data in the database. Browsers rely on this safety to cache GET responses aggressively.
GET /api/products
GET /api/products/42
3POST: Creating Data
The POST method is used to send data to the server to create a new resource. Unlike GET, POST requests carry a 'Body' (usually a JSON payload containing the new data). POST requests are NOT idempotent. This means if you execute the exact same POST request 10 times, the server will create 10 distinct, duplicate records in the database. When you submit a signup form, it sends a POST request. The browser knows this isn't safe to repeat blindly.
Content-Type: application/json
{
"name": "Alice"
}
4PUT vs PATCH: Updating Data
When you need to modify existing data, you use PUT or PATCH. While often used interchangeably by junior developers, they have a strict semantic difference. PUT is a complete replacement; it overwrites the entire resource. If you omit a field in a PUT request, that field is deleted. PATCH is a partial update; it only modifies the specific fields you send, leaving the rest of the object untouched. Modern architectures lean heavily on PATCH for safety.
PUT /users/1 { name: "B" }
// Result: { id: 1, name: "B" } (age lost!)
PATCH /users/1 { name: "B" }
// Result: { id: 1, name: "B", age: 20 }
5DELETE: Removing Data
The DELETE method is straightforward: it removes a specified resource from the server. Like GET, a DELETE request typically does not contain a body payload. The ID of the resource to be deleted is usually passed directly in the URL (e.g., /users/42). It is also idempotent; deleting a resource once removes it, and firing that same delete request again just results in a 404 (because it's already gone), leaving the server in the exact same state.
DELETE /users/42
