HTTP Methods Reference

Complete reference for HTTP request methods. Learn how GET, POST, PUT, and DELETE work, when to use each, and see real-world examples.

GET POST PUT DELETE

GET Retrieve a resource

The GET method requests a representation of the specified resource. Requests using GET should only retrieve data and have no other effect on the data.

Request
Response
GET /api/users/42 HTTP/1.1 Host: api.example.com Accept: application/json Authorization: Bearer <token> # No request body
200
OK — resource returned
404
Not found

POST Create a resource

The POST method submits data to be processed to the specified resource. It often causes a change in state on the server or side effects such as creating a new record.

Request
Response
POST /api/users HTTP/1.1 Host: api.example.com Content-Type: application/json Authorization: Bearer <token> { "name": "Alice", "email": "alice@example.com" }
201
Created
400
Bad request / validation error

PUT Update a resource

The PUT method replaces all current representations of the target resource with the request payload. Unlike PATCH, it replaces the entire resource.

PUT /api/users/42 HTTP/1.1 Content-Type: application/json { "name": "Alice Smith", "email": "alice@example.com", "role": "admin" }
200
Updated successfully
422
Unprocessable entity

Idempotency

GET, PUT, HEAD, OPTIONS, and DELETE are idempotent — calling them multiple times produces the same result. POST is not idempotent: submitting the same form twice creates two records.

# Safe + idempotent GET /articles/1 → always returns same article DELETE /articles/1 → deletes once, further calls = 404 # Not idempotent POST /orders → creates a new order each time