REST API

A JSON API for Postman, REST Assured, Playwright request, Karate and similar tools. Base URL:

Ground rules

MethodPathDescription
GET/api/healthHealth check
POST/api/auth/loginBody {"username":"practice","password":"SuperSecret123"} → token
GET/api/users?page=1&limit=6&search=qaPaginated, searchable list
GET/api/users/{id}One user, 404 if missing
POST/api/usersCreate. name and email required → 201, 409 on duplicate email, 422 on bad input
PUT/api/users/{id}Replace a user
PATCH/api/users/{id}Update some fields
DELETE/api/users/{id}Delete → 204
POST/api/resetRestore your sandbox's seed data
GET/api/status/{code}Responds with any status between 200 and 599
GET/api/delay/{seconds}Slow response (max 10 s) for timeout tests
ANY/api/echoReturns the method, query, headers and body you sent

Example (curl)



    

Try it

Status: –


    

Exercises

These use Playwright's built-in request fixture, so no browser is opened. With baseURL set in your config (see the home page), paths like /api/users work as-is.

1. Create, read, update, delete

Intermediate

Log in for a token, then take a user through its whole life cycle in your own sandbox.

Expected: login returns 200 with a token; creating returns 201 and the new user with an id; reading it back returns the same data; PATCH changes only the job; DELETE returns 204; reading it again returns 404.

Show me how

2. Error responses

Intermediate

Check that the API refuses bad requests with the right status code and a useful body.

Expected: creating a user without a token → 401; with an invalid email and a one-letter name → 422 with a message per field in fields; creating the same email twice → 409; a wrong password at login → 401.

Show me how

3. Pagination and search

Intermediate

Read the user list a page at a time, then search it.

Expected: with limit=5 a fresh sandbox reports total: 12 and totalPages: 3; walking all pages returns 12 unique users; every result for search=qa contains "qa" in its name, email or job.

Show me how

4. Status codes and timeouts

Advanced

Use /api/status/{code} and /api/delay/{seconds} to test how your client handles failures and slow servers.

Expected: each status code you ask for comes back unchanged; a 3-second delay with a 1-second client timeout fails with a timeout error; with a 5-second timeout the same request succeeds.

Show me how