Testing APIs with Postman
Part of the Web Development Roadmap
In short
Before any frontend exists, you still need to poke your API: log in, grab the token, call a protected route. Postman turns that into a few clicks instead of a pile of curl commands.
Postman is a tool for sending requests to your API by hand, checking responses and saving them as collections, so you can test the backend before any frontend exists.

Think of it like this
The mechanic's test bench
A good mechanic doesn't fit an engine into a scooter just to check it. He clamps it on a bench, connects gauges and revs it. Postman is your API's test bench: fire real requests, watch the responses, and save the whole setup for next time.
Watch it happen
Login, save token, call a protected route
POST /auth/login
1/5You send a login request with an email and password in the JSON body.
The big ideas
What you need to know
Collections group requests
Save requests in folders by feature. A teammate imports the collection and runs the same calls.
Environments hold variables
Keep baseUrl and tokens in Local, Staging and Prod environments, then switch with one dropdown.
Scripts and tests
Small JavaScript snippets run after a response to check status codes and store values for later requests.
Share, don't screenshot
Export the collection as JSON into your repo, so the whole team tests the same way.
See it in code
Walk through the code
1pm.test("login returns 200", () => {2 pm.response.to.have.status(200);3});4 5pm.test("response has a token", () => {6 const body = pm.response.json();7 pm.expect(body.token).to.be.a("string");8 pm.environment.set("token", body.token);9});1/3pm.test names a check. This one fails if login didn't return 200.
Paste this into the login request's Scripts tab, under Post-response. Results show in Test Results after you hit Send.
Save yourself the pain
Common mistakes
Oops
Hardcoding http://localhost:3000 and real tokens in every request.
Do this instead
Use {{baseUrl}} and {{token}} from an environment. Switching servers then takes one click.
Oops
Sharing environments that contain real passwords or production keys.
Do this instead
Keep secrets in local values or a vault. Share only collections and placeholder environments.
Your mission
Build a mini collection
Quick check
Why write {{baseUrl}} in requests instead of the full URL?
Go deeper
- 1Create a Postman collection with every route of your API.
- 2Use an environment variable for the base URL so you can switch between local and live.
- 3Send invalid data on purpose and check your API returns the right error.
Also part of these roadmaps
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.