Record Any API, Anywhere: Local-First API Recording New WireMock CLI

Sometimes the APIs you need are accessible via the internet… but sometimes they aren’t (e.g. microservices). Our new, CLI-based API recording lets you simulate non-public APIs by recording responses on your local machine, which then instantly updates your WireMock Cloud stubs. It’s a fast, easy, and flow-maintaining way to setup new mock endpoints.
Watch the video:
Why Record APIs Locally?
WireMock Cloud has long had the ability to record traffic to any API in order to automatically create a simulated version of that API. It will even automatically create an OpenAPI spec based on the recording. This is consistently one of the fastest and most empowering ways for folks to get started with WireMock Cloud - especially in cases where you have no direct control over the dependency you are mocking. With recording, you can get a high-resolution mock without needing to know much about it ahead of time.
However, there is one limitation that holds some teams back. Until now, recording with WireMock Cloud had to go through our web services, which meant you couldn’t record anything that our web services couldn’t reach - for example, microservices operating inside of the customer’s private cloud, or APIs that required a higher level of authentication.
⚡️Enter The WireMock CLI
Our new CLI will be the backbone of a developer-first experience we’ll be rolling out over this year, but in this first version we put recording in your hands so that you can record traffic anywhere - on your laptop, behind a firewall, in a cluster.
This means you can now instantly record and simulate any API even when that API is not publicly accessible or is not live yet. We’ve also included support for client certificate authentication so it’s now possible to capture traffic to/from mTLS secured microservices.
Let’s look at how!
🎥 Local Recording in Practice
To record any API, simply:
1/ Install the CLI
2/ /Log the CLI into WireMock Cloud. You can use any existing WireMock Cloud account, or create a new one
3/ Run record to start capturing traffic locally:
4/ Now make some HTTP requests, using http://localhost:8000 as the base URL, since this is the proxy address exposed by WireMock CLI when recording (you can change the port number if you wish).
When you’ve made all the requests you wish to capture, hit Enter to terminate the recording.
5/ Head over to WireMock Cloud’s web UI to see the results of the recording. You can use the test request maker to try out some of the stubs you created, or if this is a REST mock you can enable the public docs and make test requests from within there.
6/ Alternatively you can test your mock by making exactly the same requests you made during recording - you should get exactly the same responses back, only you won’t hit the real API this time.
💻 Give It a Try
The CLI is now available with local recording, so check out the docs for more information on how to get started. You can use your existing WireMock Cloud account, or create a new one directly from the CLI. And, as always, get in touch with your feedback!
/