HTTP Methods Overview
Fast recall
Quick revision
Core answer
GET retrieves a representation, POST submits data for processing, PUT replaces target state, PATCH applies change instructions, and DELETE removes the URI's current association. HEAD and OPTIONS support retrieval metadata and capability checks, respectively; TRACE and CONNECT are specialized protocol methods rather than normal REST resource operations.Interview-ready guide
Interview answer
An HTTP method tells the server what kind of action the client wants for the resource identified by the URI. It is part of the HTTP contract, not just a label on a controller method. Clients, browsers, caches, and gateways use that shared meaning when they send, cache, prefetch, or retry a request.
GET retrieves a current representation. HEAD asks for the response that GET would produce but does not transfer response content; content-specific fields that require generating the content may be omitted. OPTIONS describes communication options for a resource or server. TRACE performs a diagnostic loop-back, and CONNECT asks a proxy to establish a tunnel. TRACE and CONNECT are specialized protocol methods rather than normal REST controller operations.
POST submits content for processing according to the target resource's own rules. POST /orders may create an order, but POST can also submit a search, start a job, or run a command. It is broader than “create.”
PUT sends the state that should exist at a known target URI. The server creates or replaces that state, and repeating the same PUT has the same intended effect. PATCH sends a patch document—a set of changes whose meaning comes from its media type. A PATCH operation can be designed to be idempotent, but the method does not guarantee that property.
DELETE asks the server to remove the target URI's current association. It does not define how a database, audit record, or backup must be erased. Method choice also communicates safety and idempotency: safe methods do not ask for a business-state change, while idempotent methods can be repeated with the same intended effect. The implementation must still keep those promises.
HTTP Methods Overview
Direct Answer
In a typical REST API, the main HTTP methods describe what a client wants to do with a target resource: GET retrieves a representation, POST submits data for processing, PUT replaces target state, PATCH applies change instructions, and DELETE removes the URI's current association. HEAD and OPTIONS support retrieval metadata and capability checks, respectively; TRACE and CONNECT are specialized protocol methods rather than normal REST resource operations.
Deep Dive & Architecture
The URI identifies the target resource; the method supplies the request's basic meaning. That split lets an intermediary understand useful properties without knowing the Java code behind the endpoint. A cache can treat GET specially, a crawler can follow safe links, and a client can decide whether a failed request is normally safe to retry.
CRUD is a helpful memory aid, but it is not the definition of the methods. POST is not limited to CREATE, DELETE does not describe a SQL DELETE statement, and PATCH is not simply “PUT with fewer fields.” Headers can further refine the request—for example, If-Match can make an update conditional on the resource version—but they cannot contradict the method's core meaning.
An API that uses POST for every action can still transfer data, but it hides information that HTTP could have given to clients and infrastructure.
Code Example
GET /orders/42 HTTP/1.1
Host: api.example.com
POST /orders HTTP/1.1
Host: api.example.com
Content-Type: application/json
Content-Length: 28
{"itemId": 7, "quantity": 2}
DELETE /orders/42 HTTP/1.1
Host: api.example.com
The paths identify an order collection or one order. The methods change the meaning: retrieve order 42, submit a new order to the collection, or remove the current association for order 42.
Check your understanding
Answer these without looking back at the article.
- Why is POST not limited to resource creation?
- What does a successful DELETE guarantee about storage?
- How is HEAD related to GET?
Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.