Hypertext Transfer Protocol

Hypertext Transfer Protocol

Whenever you go to your browser, type a URL, and press Enter, it performs complex actions and returns a webpage consisting of text, images, videos, spreadsheets, and hypertext. It may seem like only the client and server are involved in sending data, but in this article, I am more interested in discussing the basic aspects involved in making an HTTP request successful.


What is HTTP?

HTTP (Hypertext Transfer Protocol) is the base protocol that consists of rules for data communication on the World Wide Web. It is designed to send and receive data from a backend database using a URL (Uniform Resource Locator). The HTTP protocol is designed to run on the application layer at the top of the protocol stack in the OSI Model. HTTP typically involves two entities: a client and a server. The client makes the request using a URL, and in return, the server sends a response to the client.

What is HTTP Request?

HTTP Request is a way over internet in which client (web browser or a website) asks for information required to load a webpage, video, image, videos etc.

Each HTTP Request made across the internet consist of series of encoded data that carries different type of information.

  1. HTTP Request method
  2. HTTP version type
  3. HTTP Request body
  4. HTTP Request Headers

When a request is made it must contain these essential details like request method, request headers and request body than a response is generated from the backend server that must contain response headers and response body too.

Please look at the image attached for your reference that will give you more clarity on how a HTTP request looks like.


Article content
A typical HTTP request

What is HTTP Response?

An HTTP Response is a way in which web browser and client that sent a request previously receives a request from the backend database/server in response to the request made. These HTTP response contains some valuable information that is based on the information asked in the HTTP request.

A typical HTTP response consist of following information

  1. HTTP Status code
  2. HTTP Response headers
  3. HTTP Response body

Now Let's talk about HTTP Request and HTTP response in detail which will help us to understand each and every aspect in detail

Please look at the image attached for your reference that will give you more clarity on how a HTTP response looks like.


Article content
A typical HTTP response

What are HTTP Request Headers?

HTTP request headers are specialized way of client(web browser, website) to send information to backend server to make them understand what is the information that the client is asking for

These HTTP request headers consist of following information

  1. Host Header which consists the value of actual application
  2. Resource path where the resource actually exists
  3. Content-Type that will be sent in request body to the backend server
  4. Content-Length that gives us the total length of request body
  5. user-agent is the application used to make the request.

What are HTTP Request Methods?

HTTP request methods are also called as HTTP verbs, that indicates what action should be taken by the backend server. HTTP request methods helps to identify what action server should perform. Some of the major actions are

  1. GET method is used to fetch some information from the backend.
  2. POST is used to add data to the database sent in request body.
  3. PUT is used to update the existing data from the database.
  4. DELETE is used to delete data from the database.
  5. HEAD is used to fetch only the response headers in response excluding the response body.
  6. OPTIONS is used to find what all methods are allowed on the backend server.
  7. TRACE method is used to track the path of the HTTP request for diagnostic purposes.

What is HTTP Request body?

The HTTP Request body consists of information that is transmitted over the communication channel from client to the backend server, information that is being processed by the backend server and then the response will be returned based on the data provided.


What is HTTP status code?

HTTP status code are 3 digit codes that basically indicated what actually happened to the request sent to the backend server. Some of the common and well known status codes are

  1. 1xx Informational
  2. 2xx Success
  3. 3xx Redirection
  4. 4xx Client side errors
  5. 5xx Server side errors

What is HTTP Response Headers?

Unlike Request headers, response headers comes with different type of headers that conveys very important information like server related information, security headers information which is directly associated with security of the application requested.

What is HTTP Response body?

HTTP response body consist of information that is sent back by the server. This information could be different based on the HTTP request method used to send the request. GET method can have very huge data in the response body, POST method can have token or an API key that would be further used by the application to fetch data from the server. Therefore response body can differ in size based on the method used to send the request.


So, this was all about the basics that is required to understand HTTP to build the foundation to understand HTTP protocol in more detail.


Kindly stay tuned for more articles with detailed information.


To view or add a comment, sign in

Others also viewed

Explore content categories