API Testing with Postman

Learn how to test REST APIs manually using Postman. Understand HTTP methods, status codes, and how to verify response bodies.

Manual QA Module 3 Lesson 1
12 min read

What you'll learn

  • Understand what an API is and why to test it
  • Send GET, POST, PUT, and DELETE requests in Postman
  • Read HTTP status codes and response bodies
  • Assert on response structure and values

API Testing with Postman

The app you see on screen is only the tip of the iceberg. Underneath, it is talking to a server all day, every day. API testing lets you check that conversation directly.

What is an API?

Why Test the API Separately?

UI Testing

  • Tests what the user sees
  • Slow — loads pages, clicks buttons
  • Breaks when designs change
  • Hard to isolate bugs
  • Finds bugs late

API Testing

  • Tests the data directly
  • Fast — just requests and responses
  • Stable even when UI changes
  • Bugs point straight at the server
  • Finds bugs early, before the UI is built

VerdictAPI testing is faster, more stable, and catches bugs earlier. UI testing still matters, but API tests do more for less.

HTTP Methods

Every API request uses a “method” that describes what you want to do.

MethodWhat it doesEveryday analogy
GETRead data”Show me the menu”
POSTCreate something new”Add this dish to my order”
PUTUpdate something”Change my order to medium rare”
DELETERemove something”Cancel my order”

Status Codes

When the server answers, it always includes a 3-digit code telling you how it went.

2xx — Success
3xx — Redirect
4xx — Your mistake
5xx — Server mistake
  • 2xx — Success:It worked!
  • 3xx — Redirect:Look somewhere else for it.
  • 4xx — Your mistake:The request was wrong.
  • 5xx — Server mistake:The server broke.
Remember: 4xx is YOUR fault. 5xx is the SERVER's fault.

Common Status Codes

CodeNameMeaning
200OKRequest succeeded, here is the data
201CreatedNew thing was made successfully
400Bad RequestYour request was malformed
401UnauthorizedYou are not logged in
403ForbiddenYou are logged in, but not allowed
404Not FoundThat thing does not exist
500Server ErrorThe server crashed or broke

Quick check

Question 1 of 10 correct

You send a request and get a 500 response. Whose fault is it most likely to be?

Anatomy of a Request

Request

4 fields
URL:"https://api.example.com/users/1"
Method:"GET, POST, PUT, or DELETE"
Headers:"Auth token, content type, etc."
Body:"JSON data (only for POST/PUT)"
Every request you send has these 4 pieces.

Anatomy of a Response

Response

3 fields
Status Code:"200, 404, 500, etc."
Headers:"Content type, cache info, etc."
Body:"JSON data the server returned"
Every response has these 3 pieces.

A Real Request in Postman

Here is what a simple GET request looks like.

Postman: GET a user
$ GET https://api.example.com/users/1# Headers: Authorization: Bearer abc123HTTP/1.1 200 OKContent-Type: application/json {  "id": 1,  "name": "Alice",  "email": "alice@example.com"}

Try it in your terminal!

And here is a POST request that creates a new user.

Postman: POST a new user
$ POST https://api.example.com/users# Body: { "name": "Bob", "email": "bob@example.com" }HTTP/1.1 201 Created {  "id": 42,  "name": "Bob",  "email": "bob@example.com"}

Try it in your terminal!

What to Assert on a Response

Common Bugs You Will Find


Practice: Match Status Codes to Meanings

Drag each status code to its correct meaning.


Quiz

Question 1 of 30 correct

You send a POST request to /users to create a new user. What is the MOST appropriate successful status code?