Lesson 1 of 10Beginner
API Testing Fundamentals
Why test the API layer?
API tests hit your business logic directly — no browser, no rendering. They're faster, more stable, and pinpoint failures more precisely than UI tests. A healthy suite tests most logic at the API level and keeps UI tests for critical user journeys.
The HTTP you must know
| Method | Purpose |
|---|---|
| GET | Read a resource |
| POST | Create a resource |
| PUT / PATCH | Replace / partially update |
| DELETE | Remove a resource |
Status code families: 2xx success · 3xx redirect · 4xx client error (bad request, unauthorised, not found) · 5xx server error.
A request has a method, URL, headers and (often) a JSON body; a response has a status code, headers and body. Your tests assert on all of these.
Key takeaways
- API tests are faster and less flaky than UI tests — push logic-testing here.
- Know your verbs and status-code families cold.
- You'll assert on status, headers and body.