I've written a fair number of Playwright tests, but almost all of them were UI tests — clicking buttons, filling forms, waiting for a modal to show up. At some point I wanted to get better at API testing specifically, and the annoying part was finding a decent playground API to practice on. Half of the "free public APIs" out there either require a signup, have a rate limit that kicks in after ten requests, or return data so bland you forget what you were even testing five minutes later.
Then I found funapi.dev, a small collection of mock REST APIs built specifically for testing practice. No signup, no API key for the read endpoints, and — the part that got me — one of the APIs is a Star Wars-themed one with characters, planets, and starships. That's exactly the kind of nonsense I want to be querying at 11pm instead of a generic "todos" API.
So I decided to write this post as a walkthrough: setting up Playwright for API testing from scratch, then writing a handful of real tests against the Star Wars API. If you're new to API testing, or new to Playwright in general, this should get you from zero to "okay, I actually understand what's happening" in about fifteen minutes.
Why bother with an API test instead of a UI test?






