New in 2.4: Test runs you can trust See what's new →

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

#SkillRequestAssert
1Status and headersGET /api/products?page=1&limit=2200, two items, X-Total-Pages: 10
2Filtering and sortingGET /api/products?category=electronics&sort=price&order=descEvery item is electronics, prices descend
3CRUD/api/PostsCreate, read, update, delete, then 404
4Negative testPOST /api/Posts400 for an empty object
5Not foundGET /api/Posts/999999404 with a JSON error
6AuthenticationGET /api/auth/jwt/me401 without a token, 200 with one
7AuthorizationGET /api/auth/jwt/admin403 with a token for user
8Rate limitsGET /api/RateLimitSixth call is 429 with Retry-After
9RetriesGET /api/chaos/retry/my-key503 three times, then 200
10TimeoutsGET /api/todos/1?delay=3A 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.

GET/api/products?page=1&limit=2

Exercise 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.

Text
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}                                                        404

Exercises 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.

POST/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.

Terminal
$ 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.

Terminal
$ 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
429

Exercises 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.

Terminal
$ 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                              # reset

For 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.