API testing practice: 10 exercises on a free live API
Ten exercises from a first GET to retries, each with the result to assert.
Examples last run against the API on
To practise API testing you need a live API that behaves like a real one: it should save data, reject bad input, enforce auth and limit requests. https://api.testingapis.com does all four, for free, with no sign-up. The ten exercises below go from a first GET to retry logic. Each one states the result to assert, and all of them were run against the live API on 1 November 2026. Use any tool you like, such as Postman, curl, REST Assured, Playwright or pytest.
The ten exercises
| # | Skill | Request | Assert |
|---|---|---|---|
| 1 | Status and headers | GET /api/products?page=1&limit=2 | 200, two items, X-Total-Pages: 10 |
| 2 | Filtering and sorting | GET /api/products?category=electronics&sort=price&order=desc | Every item is electronics, prices descend |
| 3 | CRUD | /api/Posts | Create, read, update, delete, then 404 |
| 4 | Negative test | POST /api/Posts | 400 for an empty object |
| 5 | Not found | GET /api/Posts/999999 | 404 with a JSON error |
| 6 | Authentication | GET /api/auth/jwt/me | 401 without a token, 200 with one |
| 7 | Authorization | GET /api/auth/jwt/admin | 403 with a token for user |
| 8 | Rate limits | GET /api/RateLimit | Sixth call is 429 with Retry-After |
| 9 | Retries | GET /api/chaos/retry/my-key | 503 three times, then 200 |
| 10 | Timeouts | GET /api/todos/1?delay=3 | A 1 second client timeout fires |
Exercises 1 and 2: reads
Don't stop at the status code. Check the body and the headers too. The X-Total-Count header says 20 products in total, so with limit=2 there are 10 pages.
/api/products?page=1&limit=2Exercise 3: a full CRUD flow
Chain the requests by saving the new id into a variable. The last step is the one beginners skip: read the record again and confirm it's gone. The CRUD testing lesson explains each check.
POST /api/Posts {"userId":101,"title":"My test","body":"Practice"} 201, returns data.id
GET /api/Posts/{id} 200, title matches
PUT /api/Posts/{id} {"userId":101,"title":"Edited","body":"Practice"} 200
DELETE /api/Posts/{id} 200
GET /api/Posts/{id} 404Exercises 4 and 5: negative tests
Assert the status and the message, because a wrong error can still carry the right code. Exercise 4 returns Missing required field: title.
/api/Posts{}Exercises 6 and 7: 401 and 403
These two are easy to mix up. A 401 means the server doesn't know who you are, and a 403 means it does but you lack the role. The demo logins are admin / admin123 and user / user123. Log in as admin to see the same request pass.
$ curl -i https://api.testingapis.com/api/auth/jwt/me
HTTP/1.1 401 Unauthorized
$ curl -X POST https://api.testingapis.com/api/auth/jwt/login \
-H "Content-Type: application/json" \
-d '{"username":"user","password":"user123"}'
{"accessToken":"eyJhbGci...", ...}
$ curl -i -H "Authorization: Bearer <accessToken>" https://api.testingapis.com/api/auth/jwt/admin
HTTP/1.1 403 Forbidden
{"status":403,"error":"Forbidden","message":"Your token is valid but lacks the role this endpoint requires."}Exercise 8: a real 429
The limit is five requests a minute per client. Send your own X-Client-Idso other people's traffic doesn't count against you, and assert that X-RateLimit-Remaining falls by one on each call.
$ for i in 1 2 3 4 5 6; do
curl -s -o /dev/null -w "%{http_code}\n" -H "X-Client-Id: my-practice" https://api.testingapis.com/api/RateLimit
done
200
200
200
200
200
429Exercises 9 and 10: retries and timeouts
Use a key of your own. The counter is per key, so your test decides when the failures stop. Every response has an X-Attempt header, and failures send Retry-After: 1.
$ curl -s -o /dev/null -w "%{http_code}\n" https://api.testingapis.com/api/chaos/retry/my-key # 503
$ curl -s -o /dev/null -w "%{http_code}\n" https://api.testingapis.com/api/chaos/retry/my-key # 503
$ curl -s -o /dev/null -w "%{http_code}\n" https://api.testingapis.com/api/chaos/retry/my-key # 503
$ curl -s -o /dev/null -w "%{http_code}\n" https://api.testingapis.com/api/chaos/retry/my-key # 200
$ curl -X DELETE https://api.testingapis.com/api/chaos/retry/my-key # resetFor exercise 10, set your client's timeout below the delay and assert that it raises a timeout rather than returning a response. The resilience tutorial turns both exercises into a tested retry policy.
Automating the exercises
Build these as a collection in the Postman course or as Java tests in the REST Assured tutorial. If you're comparing practice APIs, see free fake APIs compared.