HTTP request methods explained

HTTP defines nine standard request methods, but most everyday traffic uses only a few of them. This table explains each method, whether it is safe and idempotent, and the status codes a successful call returns.

Updated:

MethodPurposeSafe?Idempotent?Success status
GETRetrieve a resourceYesYes200 OK
HEADRetrieve headers only, no bodyYesYes200 OK
POSTCreate a resource or trigger an actionNoNo201 Created
PUTReplace a resource entirelyNoYes200 OK / 204 No Content
PATCHApply a partial updateNoNo200 OK
DELETERemove a resourceNoYes200 OK / 204 No Content
OPTIONSCORS preflight; list allowed methodsYesYes204 / 200 OK
TRACEEcho the request back for diagnosticsYesYes200 OK
CONNECTOpen a tunnel, e.g. HTTPS via a proxyNoNo200 OK

Notes

Frequently asked questions

What is the difference between GET and POST?
GET retrieves a resource without side effects and can be repeated safely; parameters travel in the URL. POST creates something or triggers an action, may change state, and should not be repeated blindly.
What does it mean for an HTTP method to be safe?
A safe method never modifies server state, so it can be called without risk. GET, HEAD, OPTIONS and TRACE are safe; POST, PUT, PATCH and DELETE are not.
What is the difference between PUT and PATCH?
PUT replaces the whole resource with what you send; PATCH applies a partial change to selected fields. PUT is idempotent, so repeating it gives the same result; PATCH generally is not.
What does the HEAD method do?
HEAD behaves like GET but returns no response body. It is useful for checking whether a resource exists, its size or headers, without downloading the whole content.