<mock_api_id>
is the ID of the Mock API that should receive the recorded stubs. At present you can get that
value by browsing into a Mock API at https://app.wiremock.cloud and extracting it from the URL - for instance in the URL
https://app.wiremock.cloud/mock-apis/33eye3l9/stubs/1e0d7dc0-06a0-49a2-81a7-f5d6a40bfa3d
, the ID is 33eye3l9
so you
should record as so:
<enter>
to save the
stubs to your Mock API in WireMock Cloud and the CLI will exit.
You can specify the port the server should listen on using -p
or --reverse-proxy-port
:
Importing recordings as you go along
By default, all the recorded requests are held in memory, and sent to the destination Mock API in WireMock Cloud at the end of the recording session. This may not be desirable; if you are doing a long recording session this may be prone to losing too much work. If you are doing a very large recording session the resulting import may be too large for WireMock Cloud (or other intermediate infrastructure) to cope. You may use the--max-batch-requests
option to specify the maximum amount of requests to import into the destination
Mock API in a single request.
Given a max batch of N requests, an import to the mock API will occur for every N requests recorded.
This requires you to specify the ID of the Mock API you want to save to via the --to
option when launching the session.
The --max-batch-bytes
option is also available if you need control over the exact amount of bytes that can be sent in
a single request to the destination Mock API.
Given a max batch of N bytes, an import to the mock API will occur for every N bytes recorded.
Note, if a single recorded request exceeds the maximum number of bytes, this request will still be sent (in a batch of
one).
Like max-batch-requests
, this option requires you to provide a value to the --to
option when launching the session.
Advanced Recording
The WireMock CLI accepts a configuration file to control how stubs are recorded:Recording with Mutual TLS
If you need to record from an API that authenticates clients with mutual TLS, the CLI can present your private client certificate in one of two ways:Via a PEM file
If you have a file containing a PEM encoded RSA private key and X509 certificate, you can provide it as so:Using a PKCS 12 certificate store
Keeping a private key in PEM format is a security risk, so we also support supplying your client certificate in a password protected PKCS 12 store as so:Non-interactive Recording Sessions
The WireMock CLIrecord
command supports running in non-interactive mode, making it ideal for
CI/CD pipelines and automated environments where user interaction is not possible or desired. See the
Non-interactive Recording for more details.