HTTP Basics🌍

PrashantPrashant
2 min read

Hi! Welcome back to the blogs again. It's been a while since I last uploaded my blogs. So in today's blog, I will try to explain what HTTP is and its basics. I am no expert; I'm just a learner who is trying to understand different things that are essential to my DevOps journey. Now let's begin.🚀

What is HTTP🌐

HTTP is a protocol that allows client to communicate with servers. Here client is web-browsers or apps. It follows Request Response Model. Clients send the request and server processes the request.

Request Structure📝

The request structure consist of:-

  1. Request Line

  2. Headers

  3. Body(Optional)

Request Line It defines the HTTP method, URL and HTTP version.

GET /users HTTP /1.1

Headers It contains additional information like content type, authorizations etc.

Content-Type: application/json
Authorization: Bearer<token>

Body It contains data for POST and PUT requests.

{  
    "name": "Pal",
    "email": "example mail"

}

Response Structure 🛠️

The response structure contains:-

  1. Status Line

  2. Headers

  3. Body

Status Line If the request was successful.

HTTP /1.1 200 OK

Headers It contains metadata like content type and server details.

Body The actual response data is stored in it.

{
    "id": 1,
    "name": "Pal",
    "email": "example mail"

}

Common HTTP Methods📜

There are five HTTP methods:-

GET - Retrieve data from server.
POST - Create a new resource.
PUT - Update an existing resources completely.
PATCH - Partially update a resource.
DELETE - Remove a resource.

HTTP Status Codes💬

Following are the code:-

200 OK - Request was successful.
201 CREATED - Resource successfully created.
400 BAD REQUEST - Client Sent invalid data.
401 UNAUTHORIZED - Authorization required.
403 FORBIDDEN - Client doesn't have permission.
404 NOT FOUND - Resource doesn't exist.
500 INTERNAL SERVER ERROR - Server side issue.

Hands On with POSTMAN API📱

I use Postman API to understand how these request works. Here are some screenshot for better understandings how things work.

GET

POST

Conclusion🎯

HTTP is a foundational protocol for the web, enabling communication between clients and servers. Understanding how HTTP requests and responses work, along with the status codes and HTTP methods, is crucial for anyone in DevOps or web development. Whether you're sending data, retrieving information, or debugging issues, HTTP knowledge will come in handy in every aspect of web applications. 🌍

Feel free to experiment with Postman or any other tools to get hands-on experience. By practicing, you’ll better grasp how HTTP plays an essential role in modern applications. Keep learning and building! 💻

10
Subscribe to my newsletter

Read articles from Prashant directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Prashant
Prashant