API testing

Understand 4xx status codes

Easy30 pts~12 min
  • 4xx semantics
  • Error envelope
Practice app · Acme REST API

A live REST + GraphQL API with auth, validation, pagination, rate limiting and an interactive request console.

BASE_URL
/api/practice
Console app
/lab/api-testing-understand-4xx-status-codes

Your starter code already declares BASE_URL — call the API relative to it.

Objective

Trigger and assert three different client errors: 400, 401 and 404, each with its documented error code.

Your task

  1. 1GET BASE_URL + "/users/9999" → assert 404 and error.code "USER_NOT_FOUND".
  2. 2POST BASE_URL + "/users" with {} → assert 400 and error.code "VALIDATION_ERROR".
  3. 3GET BASE_URL + "/auth/me" without a token → assert 401.

Acceptance criteria

  • A 404 from /users/{id}
  • A 400 from POST /users
  • A 401 from /auth/me
  • At least 3 assertions pass

Fixtures

apiKey
tqa_live_key_123
basicUser
admin
basicPassword
secret
username
qa@target.dev
password
Test@123

API testing · API Testing · HTTP fundamentals