HTTP methods are used to specify the type of action that the client wants to perform on a resource on the server.
<aside>
💡 You done NEED to use all the methods, but you always should. You can do everything you want with a GET
or POST
method, but it is usually advisable to use them right.
</aside>
Method | Description |
---|---|
GET | Retrieves data from the server. (Safe and idempotent) |
POST | Submits data to the server to create a resource. (Not idempotent) |
PUT | Replaces the entire resource with new data. (Idempotent) |
PATCH | Partially updates a resource. (Not necessarily idempotent) |
DELETE | Deletes the specified resource. (Idempotent) |
HEAD | Same as GET but only returns headers (no body). |
OPTIONS | |
CONNECT | Establishes a tunnel to the server (used in HTTPS). |
TRACE |
The OPTIONS
method is used to ask the server what it allows — like a preflight check.
It’s mostly used:
GET
, POST
, PUT
, etc.) a server allows on a particular URLTRACE
HTTP Method?