HTTP Methods
What is it?
HTTP methods (also called verbs) indicate the desired action to be performed on a resource. The main methods are GET for retrieving data, POST for creating new resources, PUT for replacing resources entirely, PATCH for partial updates, and DELETE for removing resources. Using the correct method is essential for RESTful API design and clearly communicates intent to servers and developers.
Practical example
A user management API uses different HTTP methods for different operations: GET /users retrieves a list, GET /users/123 retrieves one specific user, POST /users with a JSON body creates a new user, PUT /users/123 replaces all data for that user, PATCH /users/123 updates only the fields you send, and DELETE /users/123 removes that user. Each returns appropriate status codes like 200, 201, or 204.
Test your knowledge
Which HTTP methods are considered idempotent?