Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
Web, API & dataJuniorCommonTheory

Which parts of an API request should a tester vary, and what should be verified in the response?

Answer

Vary the method, path and path parameters, query parameters, headers, credentials, content type, body and transport conditions. Verify status and headers, schema and values, error contract, timing, persistence and downstream side effects. Also check that authorization and validation are enforced by the server, not only by the client.

Strong answer includes

  • covers every request location
  • checks side effects as well as the body
  • includes server-side authorization

Practical example

Testing a POST /orders endpoint, a tester varies the Content-Type header between JSON and an unsupported form-encoded value, sends a valid and an oversized request body, and swaps the auth token for another user's token. Beyond checking the 200 response schema, they verify the order actually appears in the database, a confirmation email fires, and — critically — that swapping the token returns 403 instead of leaking another user's order, proving authorization is enforced server-side.

#api#http#request#response

Sources

MDN HTTP referenceMozilla · HTTP methods, messages, status codes, headers, cookies and cachingOpenAPI Specification 3.2.0OpenAPI Initiative · API contracts, schemas and operation descriptionsOWASP API Security Top 10 — 2023OWASP · Authorization, authentication, resource consumption and API-specific risks