WireMock Admin API
Live templates for HTTP Client
Many live templates are available for the HTTP Client plugin, so that requests sent to the WireMock Admin API can be added to the currently edited .http or .rest file.
The templates are prefixed with wm for easier access, and can be found under Settings > Editor > Live Templates > WireMock.

Line markers for Admin API related WireMock calls
These gutter icons are available on Java method calls that invoke WireMock Admin API endpoints,
and they generate HTTP Client requests for the selected method calls.
Their aim is to provide a quick way of generating and performing requests to the Admin API based on a Java test code.

Clicking a gutter icon creates a scratch file called wiremock-admin-api-requests.http
(or opens it if it already exists), and generates a new HTTP request at the end of the file based on the live template bound to that method call. The live templates are the same ones mentioned in the Live templates for HTTP Client section above.
These gutter icons are registered and appear when
- the HTTP Client plugin is installed,
- there is a corresponding live template in the WireMock template group, with a key it is by default registered with.
Selecting the live templates is based on their keys for now, so if one alters a live template’s key, the gutter icon logic won’t insert any template.
This line marker is disabled by default, so that it doesn’t bother users who don’t actually need it.
Path param and request body resolution
Admin API endpoints rely on a mix of path parameters and request bodies to configure the requests sent to them. Thus, the gutter icon’s underlying logic analyzes the selected Java method call and its arguments, and it generates the necessary parts of the request:
- request URL
- path parameter(s) (where feasible)
- request body (where feasible)

Fallback values
Though, it tries to generate the most accurate request data possible, it has its limitations since variables, method calls, etc. may not necessarily be evaluated due to requiring runtime information. Therefore, there is a fallback mechanism with invalid values and error messages, so that users can see if they need further manual configuration of certain properties and values that could not be evaluated.
The following fallback values and logic are in place:
- integer:
9999
or-9999
depending on the context - double:
-9999.9
- long:
-9999L
- UUID:
00000000-0000-0000-0000-000000000000
- for non-evaluable expressions: depending on the context, the related property/value is either not included in the resulting JSON request body, or it uses the text of the expression enclosed by
<
and>
symbols.
Due to lack of runtime information and complexity, method call parameter types like Object
, List<>
, Map<>
and custom, non-enum types are not supported for resolution.
Methods with boolean
parameter types are not supported either, because it is not possible to provide a fallback value for them, especially in cases when the underlying values are stored as Boolean
s (three-state) but their configuration methods accept boolean
s (two-state) only.
Resolution of method arguments specified as variables or fields are supported to a certain extent.
For example, when you have the following code snippet:

the generated request will be as follows (notice the fallback values in the urlPath
and status
properties):

Live templates used
The table below lists the mappings between the method calls and the live templates bound to them.
NOTE: more mappings and advanced generation logic will be added in future releases.
Supported calls in the Java DSL
Endpoint | Live template key | Supported calls in WireMock | Supported calls in WireMockServer |
---|---|---|---|
Get all stub mappings | wmgasm | allStubMappings() static listAllStubMappings() | listAllStubMappings() |
Create a new stub mapping | wmcnsm | register() addStubMapping() static stubFor() static givenThat() | stubFor() givenThat() |
Delete all stub mappings | wmdasm | removeMappings() static removeAllMappings() | – |
Reset stub mappings | wmrsm | resetToDefaultMappings() static resetToDefault() | resetToDefaultMappings() |
Persist stub mappings | wmpsm | saveMappings() static saveAllMappings() | saveMappings() |
Import stub mappings | wmism | static importStubs() importStubMappings() | importStubs() |
Get stub mapping by ID | wmgsm | getStubMapping(UUID) static getSingleStubMapping() | getSingleStubMapping() |
Update a stub mapping | wmusm | static editStub() editStubMapping() | editStub() editStubMapping() |
Delete a stub mapping | wmdsm | static removeStub(UUID) removeStubMapping(UUID) | – |
wmdmsm | static removeStub(MappingBuilder) static removeStub(StubMapping) removeStubMapping(MappingBuilder) removeStubMapping(StubMapping) | removeStub(MappingBuilder) removeStub(StubMapping) removeStubMapping(MappingBuilder) removeStubMapping(StubMapping) | |
Find stub mapping by metadata | wmfsmmd | static findStubsByMetadata() findAllStubsByMetadata() findStubMappingsByMetadata() static removeStubsByMetadata() | findAllStubsByMetadata() findStubMappingsByMetadata() |
Delete stub mappings matching metadata | wmdsmmd | static removeStubsByMetadata() removeStubsByMetadataPattern() | removeStubsByMetadata() removeStubMappingsByMetadata() |
Get all requests in journal | wmgar | getServeEvents() static getAllServeEvents() | getServeEvents() getAllServeEvents() |
Delete all requests in journal | wmdar | resetRequests() static resetAllRequests() | resetRequests() |
Get request by ID | wmgr | – | getServedStub(UUID) |
Delete request by ID | wmdr | static removeServeEvent() | removeEvent(UUID) removeServeEvent() |
Count requests by criteria | wmcr | countRequestsMatching() | |
Remove requests by criteria | wmrr | static removeServeEvents() removeEvents() | removeServeEventsMatching() |
Delete requests mappings matching metadata | wmdrmd | static removeEventsByStubMetadata() removeEventsByMetadata() find() | ˙removeServeEventsForStubsMatchingMetadata()˙ |
Find requests by criteria | wmfr | static findAll() find() | findAll() |
Find unmatched requests | wmfur | findAllUnmatchedRequests() static findUnmatchedRequests() | findAllUnmatchedRequests() findUnmatchedRequests() |
Retrieve near-misses for all unmatched requests | wmgnm | static findNearMissesForAllUnmatched() findNearMissesForAllUnmatchedRequests() findNearMissesForUnmatchedRequests() | findNearMissesForAllUnmatchedRequests() findNearMissesForUnmatchedRequests() |
Find near misses matching specific request | wmfnm | static findNearMissesFor(LoggedRequest) findTopNearMissesFor(LoggedRequest) | findNearMissesFor(LoggedRequest) findTopNearMissesFor(LoggedRequest) |
Find near misses matching request pattern | wmfnmp | static findNearMissesFor(RequestPatternBuilder) findAllNearMissesFor(RequestPatternBuilder) | findTopNearMissesFor(RequesPattern) findAllNearMissesFor(RequestPatternBuilder) |
Get all scenarios | wmgas | static getAllScenarios() getScenarios() | getAllScenarios() |
Reset the state of all scenarios | wmras | resetScenarios() static resetAllScenarios() | resetScenarios() |
Get global settings | wmggs | getGlobalSettings() static getSettings() | getGlobalSettings() |
Update global settings | wmugs | updateSettings() static updateGlobalSettings() | updateGlobalSettings() |
Reset mapping and request journal | wmrmj | resetMappings() static reset() | resetAll() |
Shutdown server | wmshutdown | static shutdownServer() shutdown() | shutdownServer() shutdown() |