HTTP Methods

The HTTP method indicates the action that the request wants to perform on the requested resource.

Method Action
GET Retrieve information from the server. Should not modify the data on the server. It can be cached, bookmarked, and may remain in the browser history.
HEAD Similar to GET, except it transfers the status line and headers only. Should not modify the data on the server. It cannot be bookmarked and does not remain in the browser history.
POST Send data to the server, including images, JSON strings, file downloads, etc. It cannot be cached, bookmarked, and not stored in the browser history.
PUT Replace or update an existing resource on the server. May change server status. It cannot be cached, bookmarked, and not stored in browser history.
PATCH Partially modify the specified resource on the server. It is faster and requires less resources than the PUT method. It cannot be cached, bookmarked, and not stored in browser history.
DELETE Delete a resource from the server. May change server status. It cannot be cached, bookmarked, and not stored in browser history.
OPTIONS Used by browsers for CORS operations. Describes the communication options available for the requested resource. Does not change data on the server. It cannot be cached, bookmarked, and not stored in browser history.
CONNECT Establishes two-way communication with the server by creating an HTTP tunnel through a proxy server.
TRACE It is designed for diagnostic purposes. When used, the web server sends back to the client the exact request that was received.

See also: HTTP Methods for CRUD Operations.

Safe HTTP Methods

Several common HTTP methods are designed to be safe: GET, HEAD, OPTIONS. Safe methods don't alter the state of the server, the operation implementing by such method must be read-only.

Safe methods are also idempotent.

Idempotent HTTP Methods

The HTTP method is called idempotent if it produces the same result when several identical requests are made. DELETE, GET, HEAD, OPTIONS, PUT and TRACE and idempotent methods.

Cacheable HTTP Methods

An HTTP response is cacheable if it can be stored in the browse's (or proxy server) cache and retrieved later.

  • The response can be cached if the request method is cacheable, for example, GET or HEAD.
  • There should not be specific headers that prevent caching, such as Cache-Control: no-cache.
  • The status code should be cacheable and known by the caching application. For example: 200, 203, 204, 206, 300, and 301.
Last updated: Jun 29, 2020 Viewed: 10384 times
(0 votes)
http-method http-request http-protocol