Mock APIs
Teams
Organisations
Data sources
Database connections
Usage
Access control
Stub Mappings
- GETGet all stub mappings
- POSTCreate a new stub mapping
- DELDelete all stub mappings
- POSTReset stub mappings
- POSTPersist stub mappings
- POSTImport stub mappings
- GETGet stub mapping by ID
- PUTUpdate a stub mapping
- DELDelete a stub mapping
- POSTFind stub mappings matching metadata
- POSTDelete stub mappings matching metadata
Requests
OpenAPI
Imports
Start recording
Begin recording stub mappings
curl --request POST \
--url https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}/recordings/start \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '{
"targetBaseUrl": "http://example.mocklab.io",
"filters": {
"urlPathPattern": "/api/.*",
"method": "GET"
},
"captureHeaders": {
"Accept": {},
"Content-Type": {
"caseInsensitive": true
}
},
"requestBodyPattern": {
"matcher": "equalToJson",
"ignoreArrayOrder": false,
"ignoreExtraElements": true
},
"extractBodyCriteria": {
"textSizeThreshold": "2048",
"binarySizeThreshold": "10240"
},
"persist": false,
"repeatsAsScenarios": false,
"transformers": [
"modify-response-header"
],
"transformerParameters": {
"headerValue": "123"
}
}'
Authorizations
Basic authentication header of the form Basic <encoded-value>
, where <encoded-value>
is the base64-encoded string username:password
.
Path Parameters
The ID of the Mock API
5 - 10
Body
Criteria for extracting response bodies to a separate file instead of including it in the stub mapping
Size threshold for extracting binary response bodies. Supports humanized size strings, e.g. "56 Mb". Default unit is bytes.
Size threshold for extracting binary response bodies. Supports humanized size strings, e.g. "56 Mb". Default unit is bytes.
Whether to save stub mappings to the file system or just return them
When true, duplicate requests will be added to a Scenario. When false, duplicates are discarded
Control the request body matcher used in generated stub mappings
If equalTo is used, match body use case-insensitive string comparison
If equalToJson is used, ignore order of array elements
If equalToJson is used, matcher ignores extra elements in objects
auto
List of names of stub mappings transformers to apply to generated stubs
Parameters to pass to stub mapping transformers
Filter requests for which to create stub mapping
The scheme (protocol) part of the request URL
http
, https
The hostname part of the request URL
The HTTP port number of the request URL
1 < x < 65535
The HTTP request method e.g. GET
The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.
The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.
The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.
The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.
Path parameter patterns to match against in the <key>: { "<predicate>": "<value>" } form. Can only be used when the urlPathPattern URL match type is in use and all keys must be present as variables in the path template.
Require the state of the Mock API to match the provided patterns. More information on this feature can be found here.
require-state
The key of the item to match. Cannot be templated.
The context of the item to match. Can be templated.
Multipart patterns to match against headers and body.
Determines whether all or any of the parts must match the criteria for an overall match.
ALL
, ANY
Target URL when using the record and playback API
curl --request POST \
--url https://wmc.wiremockapi.cloud/v1/mock-apis/{mockApiId}/recordings/start \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '{
"targetBaseUrl": "http://example.mocklab.io",
"filters": {
"urlPathPattern": "/api/.*",
"method": "GET"
},
"captureHeaders": {
"Accept": {},
"Content-Type": {
"caseInsensitive": true
}
},
"requestBodyPattern": {
"matcher": "equalToJson",
"ignoreArrayOrder": false,
"ignoreExtraElements": true
},
"extractBodyCriteria": {
"textSizeThreshold": "2048",
"binarySizeThreshold": "10240"
},
"persist": false,
"repeatsAsScenarios": false,
"transformers": [
"modify-response-header"
],
"transformerParameters": {
"headerValue": "123"
}
}'