What You'll Learn
- What Postman is and why it's the most popular API client
- How to send your first GET, POST, PUT, and DELETE requests
- How to organize requests into collections
- How to use environments to switch between dev and prod
Why This Matters
cURL is powerful but hard to read for complex requests. Postman gives you a GUI for the same operations — fill in fields, click Send, see the response formatted nicely. It also lets you save requests, organize them into collections, and share them with your team. It is the API client most teams use for development and manual testing.
Installing Postman
- Download from postman.com/downloads.
- Install for your OS (Windows, macOS, Linux).
- Create a free Postman account (optional but recommended — syncs your work across machines).
Your First GET Request
- Open Postman. Click the + tab to create a new request.
- Make sure the method dropdown says GET.
- In the URL bar, paste:
https://jsonplaceholder.typicode.com/posts/1 - Click the blue Send button.
The response appears in the bottom panel:
- Status: 200 OK
- Time: 245 ms
- Size: 292 bytes
- Body: formatted JSON
Sending a POST Request
- Change the method dropdown to POST.
- URL:
https://jsonplaceholder.typicode.com/posts - Click the Body tab.
- Select raw and choose JSON from the dropdown.
- Paste this JSON:
{ "title": "My First Postman Post", "body": "Hello from Postman!", "userId": 1 } - Click Send.
The response should be 201 Created with your data echoed back, plus a new ID.
Adding Headers
- Click the Headers tab.
- Add a row: Key =
Authorization, Value =Bearer YOUR_TOKEN. - Add another: Key =
Accept, Value =application/json.
Postman sends these headers with every request in this tab. You can also set Content-Type here instead of using the Body tab's dropdown.
Saving Requests into Collections
Sending one-off requests is fine for testing. But for real work, you want to save requests so you can run them again and share them with your team.
- Click the Save button (top right of the request tab).
- In the dialog, give the request a name (e.g., "Get Post 1").
- Create a new collection: click + Create Collection, name it "JSONPlaceholder Tests".
- Save the request into that collection.
Now the request appears in the left sidebar under your collection. Click it any time to reload and resend.
Using Environments
Environments let you switch between different setups (dev, staging, production) without editing every request. You define variables like base_url and token, and Postman substitutes them.
Create an environment
- Click the environment dropdown (top right, says "No Environment").
- Click Add Environment.
- Name it "Dev".
- Add variables:
base_url=https://jsonplaceholder.typicode.comtoken=YOUR_DEV_TOKEN
- Save.
Use variables in requests
In your request URL, replace the hardcoded part with the variable:
{{base_url}}/posts/1
Postman substitutes {{base_url}} with the value from the active environment. Switch environments from the dropdown, and all your requests automatically use the new values.
Using variables in headers and body
Authorization: Bearer {{token}}
Variables work in headers, body, URL, and even in scripts (covered in Module 7).
Reading the Response
Postman gives you four tabs for the response:
- Body — formatted JSON, XML, HTML, or raw text
- Cookies — any cookies the server set
- Headers — all response headers
- Test Results — results of any test assertions (covered in Module 7)
You can also see the response status, time, and size at the top of the response panel.
Common Mistakes
- Forgetting to set the Body type. If you select "form-data" instead of "raw JSON", your body is sent as multipart form data and the server rejects it.
- Not selecting the active environment. If
{{base_url}}appears in the URL literally, you forgot to select an environment from the dropdown. - Hard-coding tokens in shared collections. Use environment variables. Never commit tokens inside saved requests.
- Not naming requests clearly. "Request 1", "Request 2" makes a collection useless. Name them by what they do: "Get User by ID", "Create Order".
- Ignoring response headers. The Body tab is shiny, but headers often contain what you need (rate limits, cache info, links).
Practical Exercise (15 minutes)
- Install Postman if you haven't.
- Create a collection called "JSONPlaceholder".
- Save these 5 requests into it:
- GET
{{base_url}}/posts/1 - GET
{{base_url}}/posts(list) - POST
{{base_url}}/postswith a JSON body - PUT
{{base_url}}/posts/1with a full body - DELETE
{{base_url}}/posts/1
- GET
- Create a "Dev" environment with
base_url=https://jsonplaceholder.typicode.com. - Select the Dev environment and run all 5 requests.
Mini Challenge
Create a second environment called "Open-Meteo" with base_url = https://api.open-meteo.com. Save a request that calls {{base_url}}/v1/forecast?latitude=19.07&longitude=72.87¤t=temperature_2m. Switch between environments and confirm the same saved request works for both APIs.
Key Takeaways
- Postman is a GUI API client — friendlier than cURL for complex requests.
- Save requests into collections for reuse and sharing.
- Use environments to switch between dev/staging/prod without editing every request.
- Variables like
{{base_url}}and{{token}}work in URLs, headers, and bodies. - Always check the response status, headers, and body — not just the body.
Previously: Lesson 23 covered cURL.
Today: You learned Postman — the GUI API client most teams use.
Next: Lesson 25 shows how to read and debug API responses — the skill that ties everything together.
FAQ
Is Postman free?
Yes for individual use. The free tier covers collections, environments, scripts, and the Collection Runner. Paid plans add team collaboration, history sync, and advanced monitoring. Most individuals never need to pay.
Do I need a Postman account?
No — you can use Postman without an account. But creating one syncs your collections across machines and lets you share workspaces with teammates. Recommended.
Comments
Comments
Post a Comment