Glossary Term
HTTP Method
Learn what HTTP methods are and how they define actions on resources. Understand GET, POST, PUT, DELETE, PATCH, and other methods with examples.
TL;DR: The action you want to perform on a resource (GET, POST, PUT, DELETE). Essential for building predictable, RESTful APIs that clients understand.
An HTTP method (also called a verb) is the action you want to perform on a resource. It tells the server what you want to do - retrieve data, create something new, update existing content, or delete a resource.
Think of HTTP methods like verbs in a sentence - they describe the action. The URL is the noun (what you’re acting on), and the method is the verb (what you’re doing to it).
The most common HTTP methods are:
- GET: Retrieve data (like viewing a webpage)
- POST: Create new data (like submitting a form)
- PUT: Replace existing data completely (like updating a profile)
- PATCH: Update part of existing data (like changing just your email)
- DELETE: Remove data (like deleting a post)
HTTP methods have important characteristics:
- Safe methods: Don’t change server state (GET, HEAD, OPTIONS)
- Idempotent methods: Same request multiple times = same result (GET, PUT, DELETE)
- Cacheable methods: Responses can be stored and reused (GET, HEAD)
Choosing the right method is crucial for building predictable, RESTful APIs. Each method has specific semantics that clients and servers understand.
Examples:
- GET /users/42: Retrieve information about user 42
- POST /users: Create a new user
- PUT /users/42: Replace all data for user 42
- PATCH /users/42: Update specific fields for user 42
- DELETE /users/42: Remove user 42
Related terms: HTTP Request, HTTP Response, Idempotent
Frequently Asked Questions
What is an HTTP method?
HTTP methods (also called verbs) indicate the action to perform on a resource. GET retrieves, POST creates, PUT replaces, PATCH updates, DELETE removes.
What is the difference between GET and POST?
GET retrieves data and should not modify state. POST sends data to create or process something. GET parameters are in URL, POST data is in body.
What does idempotent mean for methods?
Idempotent methods produce the same result when called multiple times. GET, PUT, DELETE are idempotent. POST is not—each call may create a new resource.
What is a safe method?
Safe methods do not modify server state. GET, HEAD, OPTIONS are safe. They should only retrieve information, never cause side effects.