API Terminologies Explained – HTTP, HTTPS, Methods, and Endpoints

๐ŸŒ 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:

RequestGET https://jsonplaceholder.typicode.com/posts/1 Response → 200 OK

๐Ÿ”ธ 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:

๐Ÿ’ก 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:

GET https://dummyjson.com/users/5

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):

{ "name": "Hitendra", "email": "hitendra@test.com", "role": "admin" }

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 ๐Ÿ‘‡

MethodDescriptionExample
GETRetrieve data from a serverGET /users
POSTSend new data to the server (create resource)POST /users
PUTUpdate an existing resourcePUT /users/3
PATCHPartially update a resourcePATCH /users/3
DELETERemove a resourceDELETE /users/3
HEADSame as GET but without body (for metadata)HEAD /users

๐Ÿ’ฌ Real-life analogy:

ActionExampleHTTP 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:

https://api.github.com/users/hitendra

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:

urn:isbn:9780141033570

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:

Base URL: https://dummyjson.com Endpoint: /products/10 Full URL: https://dummyjson.com/products/10

๐Ÿ“Š Visual Summary Diagram

[Client] → [HTTP/HTTPS Request] → [Server] ↘ Resource (e.g., /users/5) ↘ Payload (if POST/PUT) ↘ Endpoint = Base URL + Resource Path

URI, URL, URN, Endpoint




๐Ÿง  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

No comments:

Post a Comment