๐ 1️⃣ HTTP & HTTPS
๐ธ What is HTTP?
HTTP (HyperText Transfer Protocol) is the foundation of communication on the web.
It defines how data is requested and delivered between a client (like Postman or browser) and a server.
When you type a URL or send an API request:
-
The client sends an HTTP request.
-
The server processes it and returns a response (data, status code, headers).
๐งฉ Example:
๐ธ What is HTTPS?
HTTPS (HTTP Secure) is the secure version of HTTP, where communication between client and server is encrypted using SSL/TLS.
This ensures:
-
๐ Data privacy (cannot be intercepted easily)
-
✅ Authentication (verifies server identity)
-
๐ก️ Integrity (data not altered in transit)
๐ก In short:
HTTP = plain communication
HTTPS = secure & encrypted communication
๐ฆ 2️⃣ Resource & Payload
๐น Resource
In an API, everything is treated as a resource — users, posts, products, or orders.
Each resource is identified by a unique URL (endpoint).
๐ง Example:
-
/users→ represents a collection of users -
/users/5→ represents a single user with ID = 5
So when you make a request:
You’re requesting the resource “User 5.”
๐น Payload
The payload is the data sent to the server in the body of an HTTP request — usually with POST or PUT methods.
๐งพ Example (POST request payload):
Here, this JSON object is the payload that the API receives and processes.
Tip:
-
GET requests don’t usually have payloads.
-
POST/PUT requests do.
๐งฎ 3️⃣ HTTP Methods
HTTP methods define what action you want to perform on a resource.
Here are the most common methods used in API testing ๐
| Method | Description | Example |
|---|---|---|
| GET | Retrieve data from a server | GET /users |
| POST | Send new data to the server (create resource) | POST /users |
| PUT | Update an existing resource | PUT /users/3 |
| PATCH | Partially update a resource | PATCH /users/3 |
| DELETE | Remove a resource | DELETE /users/3 |
| HEAD | Same as GET but without body (for metadata) | HEAD /users |
๐ฌ Real-life analogy:
| Action | Example | HTTP Method |
|---|---|---|
| View list of customers | “Show me all users” | GET |
| Add new customer | “Register a new user” | POST |
| Update user details | “Change email of user 3” | PUT/PATCH |
| Remove user | “Delete user 3” | DELETE |
Sample HTTP post request:
๐ 4️⃣ URI, URL, URN, and Endpoint
These four terms often confuse beginners, so let’s simplify them ๐
๐งฑ URI (Uniform Resource Identifier)
A URI is a general term for identifying a resource — it can be a name, location, or both.
It’s the umbrella term that covers both URL and URN.
๐ URL (Uniform Resource Locator)
A URL tells you where a resource is located on the web.
It includes the protocol, domain, and path.
๐งพ Example:
Here:
-
https→ Protocol -
api.github.com→ Domain -
/users/hitendra→ Path to the resource
So this URL locates the user resource named “hitendra” in GitHub’s API.
๐งพ URN (Uniform Resource Name)
A URN identifies a resource by name, not by its location.
It doesn’t include protocol or domain.
Example:
This refers to a book by its ISBN number — not where it is stored.
๐ Endpoint
An Endpoint is the specific URL where an API resource can be accessed.
It’s the address you hit when making API calls.
Example:
๐ Visual Summary Diagram
๐ง Quick Recap
✅ HTTP – defines communication protocol
✅ HTTPS – secure version of HTTP
✅ Resource – entity (user, post, etc.)
✅ Payload – data sent to server
✅ HTTP Methods – actions on resources
✅ URI = identifier
✅ URL = locator
✅ URN = name
✅ Endpoint = actual callable address