Roadmap
| Block | What we cover | Time |
|---|---|---|
| A Β· Foundations | What an API is, API vs Web Service, rate limits | 15 min |
| B Β· HTTP Anatomy | Request/response parts, methods, status codes, payload, caching | 25 min |
| C Β· REST Thinking | Constraints, resources, URIs, representations | 20 min |
| D Β· Testing Strategy | What to verify, test types, bugs, challenges, tools | 30 min |
| E Β· SOAP Essentials | Envelope, WSDL, contract-first vs last, WS-Security | 20 min |
| F Β· Decide & Defend | REST vs SOAP decision matrix + rapid-fire round | 10 min |
Block A β API Foundations
A1. What is an API?
An Application Programming Interface is a contract that lets one piece of software ask another piece of software to do something β without knowing how it is done internally. The caller only knows what to send and what it will get back.
Everyday examples you can quote: payment gateways (Razorpay, Stripe), maps (Google Maps), login with Google/GitHub (OAuth), UPI apps talking to bank servers, weather widgets.
A2. API vs Web Service
| Point | API | Web Service |
|---|---|---|
| Scope | Any interface between software components | An API exposed over a network |
| Network | Not required (e.g. Java Collections API, OS APIs) | Always required |
| Styles | Library calls, REST, GraphQL, gRPC, WebSocket⦠| Traditionally SOAP, REST, XML-RPC |
| One-liner | Every web service is an APIβ¦ | β¦but not every API is a web service |
A3. Usage limits (rate limiting)
Most public APIs cap how many calls a client can make in a time window, and many bill per call. As a tester you should know the limit, test what happens when it is crossed, and make sure your automation suite does not burn through the quota.
- Crossing the limit normally returns 429 Too Many Requests, often with a
Retry-Afterheader. - Headers like
X-RateLimit-Limit/X-RateLimit-Remainingtell you where you stand. - Interview angle: βHow would you test rate limiting?β β fire N+1 requests in the window, assert 429, wait, assert recovery.
Block B β HTTP Anatomy
B1. Parts of a request and a response
| Request part | Purpose | Example |
|---|---|---|
| Method | The action | POST |
| URL / URI | Which resource | https://gorest.co.in/public/v2/users |
| Headers | Metadata as keyβvalue pairs | Authorization: Bearer <token>, Content-Type: application/json |
| Query params | Filters / pagination | ?page=2&per_page=20 |
| Body (payload) | The actual data being sent | { "name": "Asha", "email": "β¦" } |
| Protocol version | HTTP/1.1, HTTP/2 | Usually handled by the client |
A response mirrors it: status line (code + reason), headers (Content-Type, Cache-Control, Set-Cookieβ¦), and an optional body. The data you care about is the payload; everything wrapped around it (headers, auth, TLS) is transport.
B2. HTTP methods β the full picture
| Method | Used for | Safe? | Idempotent? | Has body? |
|---|---|---|---|---|
| GET | Read a resource | Yes | Yes | No |
| POST | Create / trigger processing | No | No | Yes |
| PUT | Replace a resource completely | No | Yes | Yes |
| PATCH | Update part of a resource | No | Not guaranteed | Yes |
| DELETE | Remove a resource | No | Yes | Optional |
| HEAD | Same as GET, headers only | Yes | Yes | No |
| OPTIONS | Which methods/CORS rules are allowed | Yes | Yes | No |
Safe = does not change server state. Idempotent = calling it once or ten times leaves the server in the same state. Interviewers love asking βIs DELETE idempotent?β β Yes; the second call may return 404, but the state does not change further.
B3. PUT vs POST β with a real example
POST /public/v2/users -> create a new user (server assigns id)
GET /public/v2/users -> list users
GET /public/v2/users/{id} -> read one user
PUT /public/v2/users/{id} -> replace that user's full record
PATCH /public/v2/users/{id} -> change only the fields you send
DELETE /public/v2/users/{id} -> remove that user
Can GET be used to create something? Technically a badly designed server could do it, but it breaks HTTP semantics: GET must be safe, can be cached, prefetched and bookmarked β so creation belongs to POST (or PUT when the client decides the id).
B4. Status code families
| Family | Meaning | Codes you must know |
|---|---|---|
| 1xx | Informational | 100 Continue |
| 2xx | Success | 200 OK, 201 Created, 204 No Content |
| 3xx | Redirection | 301 Moved Permanently, 304 Not Modified |
| 4xx | Client mistake | 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 409 Conflict, 422 Unprocessable, 429 Too Many Requests |
| 5xx | Server failure | 500 Internal Error, 502 Bad Gateway, 503 Unavailable, 504 Gateway Timeout |
B5. Payload size and caching
- GET carries data in the URL, so it is bounded by URL length limits of browsers/servers (commonly a few KB). Never put secrets in a GET URL β it ends up in logs and history.
- POST has no limit in the HTTP spec; real limits come from server config (e.g. body-size limits on gateways). Large payloads cost bandwidth and time β test them for 413 Payload Too Large.
- Caching keeps a copy of a response closer to the client so repeat reads are faster. Driven by
Cache-Control,ETag/If-None-Match(β 304), andLast-Modified. GET responses are cacheable by default; POST generally is not.
Block C β Thinking in REST
C1. What REST really is
REST (Representational State Transfer) is an architectural style, not a protocol. It models everything as a resource identified by a URI, and uses standard HTTP methods to act on it. A service that follows these rules is called RESTful.
C2. The six constraints (say these confidently)
- ClientβServer β UI and data storage evolve independently.
- Stateless β every request carries everything needed (token, params). The server keeps no session between calls, so it could restart between two requests and nothing breaks.
- Cacheable β responses declare whether they can be cached.
- Uniform Interface β resources by URI, manipulation via representations, self-descriptive messages.
- Layered System β load balancers, gateways and proxies can sit in between transparently.
- Code on Demand (optional) β server may send executable code, e.g. JavaScript.
C3. Resources, URIs and representations
- A resource is anything worth naming: a user, an order, a PDF, an image, a report.
- A URI identifies it:
https://api.shop.com/v1/orders/9812β scheme / host / version / collection / id. - A representation is the format it travels in β JSON (most common today), XML, plain text, HTML.
- Content negotiation: client sends
Accept: application/jsonorapplication/xml; server responds with matchingContent-Type. - Messaging: a request goes out, a response comes back β each message = data + metadata (headers).
Good URI design uses nouns, not verbs: POST /orders β not POST /createOrder. The HTTP method already is the verb.
Block D β API Testing Strategy
D1. What & why
API testing validates the business layer directly β functionality, reliability, performance and security β by sending requests and checking responses, with no UI involved.
| Benefit | Why it matters in a real project |
|---|---|
| Shift-left by default | Endpoints exist before screens, so logic bugs surface before any UI is built |
| Quick and steady runs | Nothing to render or locate, so suites finish in seconds with little flakiness |
| Works with any stack | Plain JSON/XML on the wire β Java, TypeScript, Python or Postman can all test it |
| Speeds up UI tests | Seed a learner and an enrolment through the API, then open the UI straight at the screen under test |
| Reaches hidden paths | Send values the UI would block β negative numbers, missing fields, huge strings |
D2. The verification checklist
For every endpoint, walk through this list. It doubles as your interview answer for βWhat do you check in an API test?β
- Status code β correct for both happy and negative paths.
- Response body data β values match what was sent / what the DB holds.
- Schema β field names, data types, required fields, no extra/missing keys.
- Headers β
Content-Type, caching, security headers, CORS. - Auth β 401 without token, 403 with wrong role, success with right role.
- Error handling β meaningful messages and consistent error format.
- Response time β within the agreed SLA.
- Side effects β the DB row really changed; follow-up GET returns the update.
D3. Designing the test β five-phase lifecycle
| Phase | What happens |
|---|---|
| Arrange (setup) | Get token, create test data, set base URL and headers |
| Act (execute) | Fire the request; log request and response |
| Assert (verify) | Compare actual vs expected β status, body, schema, time |
| Report | Mark pass / fail / blocked; attach logs to Allure/HTML report |
| Teardown | Delete created data so the next run starts clean |
Inputs are designed with the same techniques you use in manual testing: equivalence partitioning, boundary values (string length, number ranges, page size), negative data (missing fields, wrong types, invalid enum), and combinations of optional parameters.
D4. A complete test in Playwright + TypeScript
import { test, expect } from '@playwright/test';
const BASE = 'https://gorest.co.in/public/v2';
const headers = { Authorization: `Bearer ${process.env.GOREST_TOKEN}` };
test('create β read β delete a user', async ({ request }) => {
// Arrange
const payload = {
name: 'AWU Learner',
email: `awu_${Date.now()}@mail.test`,
gender: 'female',
status: 'active',
};
// Act
const created = await request.post(`${BASE}/users`, { headers, data: payload });
// Assert
expect(created.status()).toBe(201);
const user = await created.json();
expect(user).toMatchObject(payload);
expect(typeof user.id).toBe('number');
const fetched = await request.get(`${BASE}/users/${user.id}`, { headers });
expect(fetched.ok()).toBeTruthy();
// Teardown
const removed = await request.delete(`${BASE}/users/${user.id}`, { headers });
expect(removed.status()).toBe(204);
});Running 1 test using 1 worker
β user-lifecycle.spec.ts βΊ create β read β delete a user (1.4s)
1 passedD5. Types of API testing
| Type | Question it answers |
|---|---|
| Functional | Does each endpoint do what the spec says? |
| Validation | Is the product right β data accuracy, schema, business rules? |
| Integration / E2E | Do multiple APIs (and the UI) work together in a flow? |
| Load / Performance | How does it behave at expected and peak traffic? |
| Security / Penetration | Auth bypass, injection, data exposure, broken access control |
| Fuzz | Does random/malformed input crash it or leak info? |
| Reliability | Does it give consistent results over repeated runs? |
| Contract | Do provider and consumer still agree on the schema? |
| Documentation | Does the Swagger/OpenAPI doc match actual behaviour? |
D6. Bugs API testing typically finds
- Missing or duplicate functionality; unused flags; βnot implementedβ endpoints still exposed.
- Poor error handling β 500 instead of 400, stack traces in responses, inconsistent error formats.
- Wrong data types, null where a value is expected, wrong field names vs documentation.
- Security holes β data visible without auth, one user reading another user's record.
- Performance degradation under load; race conditions under concurrent calls.
D7. Real challenges (and how you handle them)
| Real-world headache | What an AWU tester does |
|---|---|
| Leftover test data | Unique values per run (timestamps) plus teardown calls |
| Tokens that expire mid-run | Fetch once in global setup; refresh on 401 |
| Calls that depend on each other | Chain them: create β read the id β update β delete |
| Too many optional fields | Pairwise combinations instead of every permutation |
| Deciding input values | Spec + EP/BVA, stored in JSON fixture files |
| Nothing visual to look at | Swagger, server logs and request/response attachments in the report |
D8. API vs Unit vs UI testing
| Unit | API | UI | |
|---|---|---|---|
| Who | Developers | QA / SDET (devs too) | QA / SDET |
| Box | White box | Mostly black / grey box | Black box |
| Scope | One function/class in isolation | Business logic via endpoints | End-user journeys, look & feel |
| Speed | Milliseconds | Fast | Slowest |
| When | Before the build | Once service is deployed | Once screens are ready |
D9. Tools worth naming
Postman / Newman (manual + CLI runs), Playwright request fixture (TypeScript), REST Assured (Java), SoapUI / ReadyAPI (SOAP & REST), JMeter / k6 (load), Swagger UI (exploration). Mention what you have used and why.
Block E β SOAP Essentials
E1. What SOAP is
SOAP (Simple Object Access Protocol) is an XML-based messaging protocol with strict rules. Platform- and language-independent, it is still common in banking, insurance, telecom and government integrations. It usually travels over HTTP POST, but can also use SMTP or other transports.
E2. Message structure
| Element | Required? | Role |
|---|---|---|
| Envelope | Yes β root | Marks the start/end of the message; namespace defines SOAP version |
| Header | Optional (max one) | Metadata: security tokens, transaction ids, routing |
| Body | Yes | The actual request or response data |
| Fault | Inside Body, on error | faultcode, faultstring, detail |
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:acc="http://bank.example/accounts">
<soap:Header>
<acc:AuthToken>abc123</acc:AuthToken>
</soap:Header>
<soap:Body>
<acc:GetBalance>
<acc:AccountId>AWU-1001</acc:AccountId>
</acc:GetBalance>
</soap:Body>
</soap:Envelope>E3. Rules every SOAP message follows
- Must be well-formed XML using the SOAP Envelope namespace.
- Must not contain a DTD reference or XML processing instructions.
- Envelope namespace changes with the SOAP version (1.1 vs 1.2).
E4. WSDL and the two development approaches
A WSDL (Web Services Description Language) file is the machine-readable contract: operations, input/output messages, data types and endpoint address. Import it into SoapUI and requests are generated for you.
| Contract-first (top-down) | Contract-last (bottom-up) | |
|---|---|---|
| Order | Write WSDL/XSD β generate code | Write code β generate WSDL |
| Pros | Stable contract; client & server teams work in parallel | Quick to start; easy for devs |
| Cons | More upfront effort | Contract changes whenever code changes; clients wait |
| Preferred for | Enterprise / multi-team integrations | Small internal services |
E5. Security, strengths and weak spots
- WS-Security adds message-level security: signatures, encryption, tokens (username, X.509 certificates) β on top of HTTPS transport security.
- Built-in standards for ACID transactions (WS-AtomicTransaction) and guaranteed delivery (WS-ReliableMessaging).
- Weak spots: verbose XML β bigger payloads and slower parsing; no HTTP caching for reads; tooling support varies by language.
Block F β REST or SOAP? Decide & Defend
| Decision factor | REST | SOAP |
|---|---|---|
| Nature | Architectural style | Protocol |
| Formats | JSON, XML, text, HTML⦠| XML only |
| Contract | Optional (OpenAPI/Swagger) | Formal (WSDL) |
| State | Stateless | Can be stateful |
| Caching | GET responses cacheable | Not cacheable by default |
| Security | HTTPS + OAuth/JWT | HTTPS + WS-Security |
| Transactions | Handled by the app | WS-AtomicTransaction |
| Bandwidth | Lightweight | Heavy envelope overhead |
| Typical use | Public, mobile, web & social APIs | Banking, payments, telecom, legacy enterprise |
One-line answer: choose REST for simplicity, speed and broad client support; choose SOAP when the contract, message-level security and transactional reliability matter more than speed.
Interview Questions & Answers
Q1. Is REST stateless? What does that mean?
Yes. Every request carries its own auth and context; the server stores no client session between calls.
Q2. Difference between 401 and 403?
401 = you are not authenticated (no/invalid token). 403 = you are authenticated but not allowed.
Q3. What is a payload?
The actual business data in the request/response body β separate from headers and transport details.
Q4. What does OPTIONS return?
The methods and CORS rules allowed on a resource, usually via the Allow / Access-Control-Allow-* headers.
Q5. Why is PATCH not guaranteed idempotent?
It describes a change, not a final state β e.g. βincrement balance by 10β gives a different result each time.
Q6. What is schema validation?
Checking the response structure β keys, types, required fields β against a JSON Schema or contract.
Q7. What is a WSDL?
An XML contract describing a SOAP service's operations, messages, types and endpoint.
Q8. When does an API return 204?
Success with no body β common after DELETE or an update that returns nothing.
Q9. How do you handle auth in an automation suite?
Generate the token once in setup, store it in env/config, inject via headers; never hard-code secrets.
Q10. How do APIs change without breaking clients?
Versioning (/v1, /v2), deprecation notices and sunset dates; testers keep regression suites per version.
Want to learn this live?
Small batches, real projects, mock interviews included. Sit in on a free demo class first.
See all coursesBook a mock interview