http methods

HTTP Overview and HTTP Methods explained in detail.

In this post, we will look into HTTP and HTTP methods in detail.

What is HTTP?

HTTP definition based on Mozilla Documentation

Hypertext Transfer Protocol (HTTP) is a protocol which allows the fetching of resources, such as HTML documents. It is the foundation of any data exchange on the Web and a client-server protocol, which means requests are initiated by the recipient, usually the Web browser. A complete document is reconstructed from the different sub-documents fetched, for instance text, layout description, images, videos, scripts, and more.

In simple terms, Hypertext Transfer Protocol (HTTP) is a protocol which facilitates data transfer between client and server. It is mainly designed to enable communication between server and client.

Example: Browser is an HTTP Client which request web pages to the server and server will return the web pages.

  • HTTP is simple.
  • HTTP is extensible.
  • HTTP is stateless but not session less.
Features controlled by HTTP:

Following Features can be controlled using HTTP Protocol.

  • Cache
  • Authentication
  • Sessions
  • Proxy
  • Tunneling
HTTP Flow

Below are the steps involved in basic HTTP workflow.

  • Open a TCP connection.
  • Send an HTTP Request message.
  • Read the Response Message sent by the server.
HTTP Messages Format
Request Message sent to the server:

HTTP Request Message

Response Message sent to the server:

HTTP Response Message

HTTP Methods

GET

The GET method is generally used and it is used to only retrieve the data. Browser request all the web pages and other resources using HTTP GET method.

HTTP GET Method

HEAD

The HEAD method asks for a response identical to that of a GET request, but without the response body.

HTTP HEAD Method

POST

The POST method is used to submit an entity to the specified resource, often causing a change in state or side effects on the server.

HTTP POST Method

PUT

The PUT method replaces all current representations of the target resource with the request payload.

HTTP PUT Method

DELETE

The DELETE method deletes the specified resource.

HTTP Delete Method

CONNECT

The CONNECT method establishes a tunnel to the server identified by the target resource.

HTTP CONNECT

OPTIONS

The OPTIONS method is used to describe the communication options for the target resource.

HTTP OPTIONS

TRACE

The TRACE method performs a message loop-back test along the path to the target resource.

PATCH

The PATCH method is used to apply partial modifications to a resource.

HTTP PATCH Method

 

REFERENCE

  1. https://developer.mozilla.org/en-US/docs/Web/HTTP
  2. https://www.w3schools.com/tags/ref_httpmethods.asp