API Testing for Beginners: What to Check in Every Endpoint
Most of what a web app does happens behind the UI, in its API. Testing the API directly is faster than testing through the browser, finds bugs earlier, and catches problems the UI hides, like a server that accepts an order with no address because only the front end checked it.
HTTP in five minutes
An API request has:
A method:GET (read), POST (create), PUT/PATCH (update), DELETE (remove)
A URL:https://api.example.com/v1/orders/123
Headers: e.g. Authorization: Bearer <token>, Content-Type: application/json
A body (for POST/PUT/PATCH), usually JSON
The response has a status code, headers and usually a JSON body.
Status codes to know
Code
Meaning
Typical case
200
OK
Successful read or update
201
Created
Resource created
204
No Content
Successful delete
400
Bad Request
Invalid input
401
Unauthorized
Missing or invalid authentication
403
Forbidden
Authenticated but not allowed
404
Not Found
Resource doesn't exist (or is hidden from you)
409
Conflict
Duplicate, or state conflict
422
Unprocessable
Valid JSON, invalid business data
429
Too Many Requests
Rate limited
500
Server Error
A bug on the server: always worth reporting
The endpoint checklist
1. Happy path
Correct status code (201 for create, not 200)
Response body has the expected fields, types and values
The change really happened: a GET afterwards returns the new state
2. Validation
Missing required fields → 400/422 with a clear message
Extra unexpected fields are ignored or rejected, never silently applied (e.g. "price": 0)
3. Authentication and authorization
No token → 401
Invalid or expired token → 401
A valid user accessing another user's resource → 403 or 404 (test by changing the ID)
Admin-only endpoints refuse normal users
4. Business rules
Rules enforced on the server, not just in the UI (coupon limits, capacity, stock)
Idempotency: sending the same "create order" twice doesn't create two orders, if the API promises that
State transitions: you can't cancel an already cancelled booking
5. Errors and robustness
Malformed JSON → 400, not 500
Very large bodies are rejected
Error responses don't leak stack traces, SQL or internal paths
6. Non-functional
Response time is reasonable under normal load
Pagination works: first page, last page, beyond the last page
Rate limits behave as documented
Your first automated API test
With Playwright's request context (no browser needed):
import { test, expect } from '@playwright/test';
test('rejects a booking for more guests than the room holds', async ({ request }) => {
const res = await request.post('/api/bookings', {
data: { roomId: 'harbour', date: '2026-12-01', start: '10:00', durationMin: 60, guests: 7, name: 'QA' },
});
expect(res.status()).toBe(400);
const body = await res.json();
expect(body.error.message).toMatch(/capacity|guests/i);
});
The same checks work in Postman, REST Assured (Java), pytest + requests (Python) or any HTTP client. See Postman vs code-based API testing.
Where API bugs hide
The UI validates, the API doesn't: submit directly and the rule disappears
Insecure direct object references:/orders/124 returns someone else's order
Wrong status codes: errors returned as 200 with { "success": false }
Inconsistent data: the list endpoint and the detail endpoint disagree
Practise with real requests
Open DevTools → Network while you use the apps in QAUnlocked Practice Labs. Each action is an API call you can inspect, replay and tweak, which is a great way to see whether the server enforces the same rules as the form. (Our DevTools for testers guide shows how.)
The DevTools features every manual tester should use, covering Network, Console, Application storage, device emulation, throttling and accessibility, and how each one makes your bug reports stronger.
GUI tools like Postman and code-based frameworks both test APIs well, but they suit different teams and stages. A comparison of speed, collaboration, version control, CI and maintenance.
We use cookies
We use cookies to keep you signed in and to understand how our site is used.
Be the first to comment.