Keyboard Shortcuts N Next post
P Previous post
S Save / unsave
R Read aloud
T Toggle theme
/ Focus search
Esc Close panels
🔥
Ready to read...
How API Postman Works and give the accurate results
API Postman

How API Postman Works and give the accurate results

Reviewed & accurate
AI Summary
🚀

Postman Explained Like You're 5
(But Deep Enough to Crack Any Interview)

From pizza analogies → to real API calls in 60 seconds → to 10 interview answers that get you hired

🍕 API Basics ⏱️ Hands-On 🚦 Status Codes 🤖 Automation 🎤 Interview Q&A

🍕 First — What is an API? (The Restaurant Story)

Before learning Postman, you need one thing clear: what an API actually is. Don't worry — it's easier than you think.

Imagine you walk into a restaurant. You never barge into the kitchen and cook yourself. Instead, you talk to the waiter, and the waiter talks to the kitchen.

🧑You= The Client (your app)
🤵Waiter= The API
👨‍🍳Kitchen= The Server (data lives here)
1
You say: "One cheese pizza, please!"You send a Request 📤
2
The waiter carries your order to the kitchen → The API talks to the server
3
The waiter brings back your pizza → You receive a Response 📥
💡 Simple Definition (memorize this!) An API (Application Programming Interface) is a waiter that carries messages between your app and a server. You make a request, and the server sends back a response.

📮 So What is Postman?

Here's the problem: to "order food" from a server, developers normally have to write an entire app first. That's like building a whole restaurant just to check if one kitchen makes good pizza! 😅

🪄 The One-Liner Postman is a magic phone that lets you talk to any kitchen in the world directly — no app-building, no code. Just type, click, and get your answer.
🎤 Interview-Ready Definition "Postman is a popular API platform used to build, test, document, and share APIs. It supports REST, SOAP, and GraphQL, and allows developers to send HTTP requests without writing any code."

Why developers love it:

🖱️Click, Don't CodeTest any API in seconds — zero code required.
📚CollectionsSave & organize all your requests like a recipe book.
🌍EnvironmentsSwitch between dev / staging / prod servers in one click.
🤖Automated TestsWrite JavaScript tests that run on every request.
🤝Team CollaborationShare collections with your whole team.
🆓Free to StartThe free plan is enough for learning & most jobs.

🔤 The HTTP Methods — Your 5 Magic Words

Every request you send uses one of these "verbs." Each one tells the server what you want to do:

MethodWhat it does🧒 Kid AnalogyReal-World Example
GETRead data"Can I see the menu?"Loading your Instagram feed
POSTCreate new data"I want to order a NEW pizza"Publishing a new post
PUTUpdate (replace everything)"Change my whole order to pasta"Replacing your entire profile
PATCHUpdate (only a part)"Same pizza, but add extra cheese"Changing only your username
DELETERemove data"Cancel my order!"Deleting a photo
🎤 Interview Trap: PUT vs PATCH The classic question! Remember: PUT replaces the whole pizza, PATCH just adds extra cheese. PUT = send ALL fields. PATCH = send only what changed.

⏱️ Hands-On: Your First API Call in 60 Seconds

Let's use a free fake API called JSONPlaceholder — no login, no token, perfect for practice. Ready? Go!

1
Open postman.com and sign up free (or download the desktop app).
2
Click New → HTTP Request.
3
Set the method to GET and enter this URL:
https://jsonplaceholder.typicode.com/posts/1
4
Hit the big blue Send button 🚀
5
Boom! You'll see 200 and this response:
RESPONSE · JSON { "userId": 1, "id": 1, "title": "sunt aut facere repellat provident occaecati", "body": "quia et suscipit..." }

What just happened? You asked the waiter for post #1, and the kitchen sent it back! 🎉

What to look at in the response panel:

🟢Status: 200 OK"Here's your pizza, enjoy!"
⏱️TimeHow many milliseconds the waiter took.
📦SizeHow big the response was.
📋Body TabThe actual data (in JSON format).
💡 What is JSON? Think of it as a lunchbox with labeled compartments: "title" is the label on the compartment, and "sunt aut..." is the food inside it.
Postman API request example
Postman in action — request on the left, response on the right

🚦 Status Codes — The Traffic Lights of APIs

The status code tells you instantly how things went. Here's your complete decoder ring:

CodeMeaning🧒 Kid Translation
200OK"Here's your pizza!" ✅
201Created"Your new order is confirmed!" 🎉
204No Content"Done! Nothing to show you." 👍
400Bad Request"I couldn't understand your order — you mumbled." 🤔
401Unauthorized"Who are you? Show me your ID first." 🪪
403Forbidden"I know who you are, but staff only." 🚫
404Not Found"Sorry, we don't serve that dish here." ❌
429Too Many Requests"Slow down! One order at a time!" 😤
500Internal Server Error"The kitchen is on FIRE!" 🔥
503Service Unavailable"Kitchen closed for repairs." 🛠️
🎤 Interview Trap: 401 vs 403 401 = "I don't know who you are" (no login / wrong credentials — authentication failed).
403 = "I know exactly who you are, and you're still not allowed" (authorization failed).

💌 Headers, Params & Body — The Envelope Analogy

When you mail a letter, everything has its place. An API request works exactly the same way:

🏠URLThe address on the front of the envelope.
✍️HeadersNotes on the back: "Fragile!", "From: Ravi". Example: Content-Type: application/json
📎Query ParamsNotes clipped to the outside: ?userId=1
📄BodyThe actual letter inside the envelope (your JSON data).

✍️ Hands-On: Send a POST Request

Reading is easy — now let's CREATE something! We'll send a brand-new post to the server:

1
Method → POST
2
URL → https://jsonplaceholder.typicode.com/posts
3
Go to the Body tab → select raw → choose JSON from the dropdown
4
Paste this JSON, then click Send:
REQUEST BODY · JSON { "title": "My First API Post", "body": "I made this with Postman!", "userId": 1 }
🎉 Result: 201 Created The server accepted your new post! You just created data on a server — with zero code.
⚠️ #1 Beginner Mistake Getting a 400 Bad Request error? Check that you selected "JSON" and not "Text" in the Body dropdown. This trips up almost everyone at first!

🐙 Real-World Example: The GitHub API (No Login Needed!)

Let's level up to a real API used by millions of developers every day. GitHub's public data needs no token:

https://api.github.com/repos/octocat/hello-world

Set method to GET, click Send, and you'll get real data: the repository name, description, star count, and much more.

For private data, you'd show your "VIP pass" by adding a Header:

HEADERS TAB Key: Authorization Value: Bearer your_token_here
🎫 That's Authentication The Bearer token is like showing your VIP pass at the door. No pass = 401 ("Who are you?"). Valid pass = welcome in!

🧰 Level Up: Collections, Environments & Variables

These three features separate beginners from pros — and interviewers love asking about them:

📚CollectionA recipe book of saved requests. Group all your "User API" tests together and run them all with one click.
🌍EnvironmentDifferent kitchens for different days: dev (practice kitchen), staging (rehearsal), prod (the real restaurant!).
🔑VariablesLike saved contacts in your phone. Instead of typing the full URL every time, type {{base_url}}/posts. Change the variable once — ALL requests update instantly.

🤖 Auto-Grading Your APIs: Tests in Postman

Postman can check your API's homework automatically! Go to the Tests tab and write simple JavaScript:

TESTS TAB · JAVASCRIPT pm.test("Status code is 200", () => { pm.response.to.have.status(200); }); pm.test("Response arrived quickly", () => { pm.expect(pm.response.responseTime).to.be.below(500); }); pm.test("Post has a title", () => { const data = pm.response.json(); pm.expect(data.title).to.exist; });

Now every time you hit Send, Postman shows PASS ✅ / FAIL ❌ for each check — no manual checking needed.

🎤 Interview Gold Know the difference: a Pre-request Script runs BEFORE the request (e.g., generate a timestamp or fetch a token), while a Test Script runs AFTER the response (your assertions).

🎤 The Interview Corner — 10 Questions & Crisp Answers

Q1What is Postman?
A platform for building, testing, documenting, and collaborating on APIs. It lets us send HTTP requests without writing code and supports REST, SOAP, and GraphQL.
Q2What is an API?
A set of rules that lets two software applications talk to each other — like a waiter connecting customers to the kitchen.
Q3GET vs POST?
GET retrieves data — parameters are visible in the URL, it can be cached and bookmarked, and it has no body. POST sends data to create resources — data goes in the body, it's more secure, and it's not cached.
Q4PUT vs PATCH?
PUT updates a resource by replacing it entirely — you must send ALL fields. PATCH updates only the specific fields you send.
Q5Difference between 401 and 403?
401 = authentication failed — the server doesn't recognize you. 403 = authenticated but not authorized — the server knows you, and still says no.
Q6What are Environments and Variables in Postman?
Environments are sets of key-value variables (like base_url) that let you switch between dev/staging/prod by changing one value instead of editing every request.
Q7How do you automate API testing in Postman?
Using test scripts (JavaScript) with pm.test() assertions in the Tests tab, then running entire collections with the Collection Runner.
Q8What is Newman?
Postman's command-line tool that runs collections from the terminal — used to plug Postman tests into CI/CD pipelines like Jenkins or GitHub Actions.
Q9Postman vs Swagger?
Postman is mainly a client for testing and consuming APIs. Swagger (OpenAPI) is a specification for designing and documenting APIs. They complement each other — design in Swagger, test in Postman.
Q10What authentication types does Postman support?
API Key, Bearer Token, Basic Auth, OAuth 2.0, HMAC, AWS Signature, and more — all configurable under the Authorization tab.

📋 One-Glance Cheat Sheet (Screenshot This!)

ThingRemember It As…
🔌 APIWaiter between you and the kitchen
📮 PostmanMagic phone to any kitchen
GETRead the menu
POSTPlace a new order
PUT / PATCHReplace order / add extra cheese
2xxKitchen is happy ✅
4xxYOU made a mistake ⚠️
5xxKITCHEN made a mistake 🔥
📚 CollectionRecipe book
🌍 EnvironmentWhich kitchen you're visiting
🤖 NewmanRobot that runs your tests in CI/CD

🏆 Practice Challenge (Do This Today!)

GET all posts → https://jsonplaceholder.typicode.com/posts
GET post #5 → add /5 to the URL
POST a new post with your name in the title
Try PUT and PATCH on /posts/1 — can you spot the difference?
Write a test that checks the status is 200
Break it on purpose: visit /posts/999999999 and watch the 404! 😈

🏁 Final Words

Postman turns API testing from "write a whole program" into "click Send." Master the methods, status codes, environments, and tests — and you'll walk into any API testing interview with confidence.

Test Your Knowledge
How did you find this?

Comments

Join the discussion! Sign in with your Google or Blogger account, or comment as Anonymous - no account needed. For quick questions, also reach me on Telegram @cytestch.

Comments