The WireMock admin API is described in OpenAPI 3.0. The spec file plus an instance of Swagger UI can be accessed from a running WireMock instance under /__admin/docs/
, e.g. http://localhost:8080/__admin/docs/
.
Below is the full API reference:
WireMock (3.12.0)
Download OpenAPI specification:Download
WireMock offers a REST API for administration, troubleshooting and analysis purposes
Get all stub mappings
query Parameters
limit | integer Example: limit=10 The maximum number of results to return |
offset | integer The start index of the results to return |
Responses
Response samples
- 200
{- "meta": {
- "total": 2
}, - "mappings": [
- {
- "id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
- "uuid": "76ada7b0-49ae-4229-91c4-396a36f18e09",
- "request": {
- "method": "GET",
- "url": "/search?q=things",
- "headers": {
- "Accept": {
- "equalTo": "application/json"
}
}
}, - "response": {
- "status": 200,
- "jsonBody": [
- "thing1",
- "thing2"
], - "headers": {
- "Content-Type": "application/json"
}
}
}, - {
- "request": {
- "method": "POST",
- "urlPath": "/some/things",
- "bodyPatterns": [
- {
- "equalToXml": "<stuff />"
}
]
}, - "response": {
- "status": 201
}
}
]
}
Create a new stub mapping
Request Body schema: application/json
id | string This stub mapping's unique identifier |
uuid | string Alias for the id |
name | string The stub mapping's name |
object (request-pattern) | |
object (response-definition) | |
persistent | boolean Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default. |
priority | integer >= 1 This stub mapping's priority relative to others. 1 is highest. |
scenarioName | string The name of the scenario that this stub mapping is part of |
requiredScenarioState | string The required state of the scenario in order for this stub to be matched. |
newScenarioState | string The new state for the scenario to be updated to after this stub is served. |
postServeActions | object A map of the names of post serve action extensions to trigger and their parameters. |
Array of objects The list of serve event listeners | |
metadata | object Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs. |
Responses
Request samples
- Payload
{- "request": {
- "method": "GET",
- "url": "/some/thing"
}, - "response": {
- "body": "Hello world!",
- "headers": {
- "Content-Type": "text/plain"
}, - "status": 200
}
}
Response samples
- 201
- 422
{- "id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
- "priority": 3,
- "request": {
- "headers": {
- "Accept": {
- "equalTo": "text/plain"
}
}, - "method": "GET",
- "url": "/some/thing"
}, - "response": {
- "body": "Hello world!",
- "headers": {
- "Content-Type": "text/plain"
}, - "status": 200
}
}
Get stub mapping by ID
path Parameters
stubMappingId required | string Example: 730d3e32-d098-4169-a20c-554c3bedce58 The UUID of stub mapping |
Responses
Response samples
- 200
{- "id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
- "priority": 3,
- "request": {
- "headers": {
- "Accept": {
- "equalTo": "text/plain"
}
}, - "method": "GET",
- "url": "/some/thing"
}, - "response": {
- "body": "Hello world!",
- "headers": {
- "Content-Type": "text/plain"
}, - "status": 200
}
}
Update a stub mapping
path Parameters
stubMappingId required | string Example: 730d3e32-d098-4169-a20c-554c3bedce58 The UUID of stub mapping |
Request Body schema: application/json
id | string This stub mapping's unique identifier |
uuid | string Alias for the id |
name | string The stub mapping's name |
object (request-pattern) | |
object (response-definition) | |
persistent | boolean Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default. |
priority | integer >= 1 This stub mapping's priority relative to others. 1 is highest. |
scenarioName | string The name of the scenario that this stub mapping is part of |
requiredScenarioState | string The required state of the scenario in order for this stub to be matched. |
newScenarioState | string The new state for the scenario to be updated to after this stub is served. |
postServeActions | object A map of the names of post serve action extensions to trigger and their parameters. |
Array of objects The list of serve event listeners | |
metadata | object Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs. |
Responses
Request samples
- Payload
{- "request": {
- "method": "GET",
- "url": "/some/thing"
}, - "response": {
- "body": "Hello world!",
- "headers": {
- "Content-Type": "text/plain"
}, - "status": 200
}
}
Response samples
- 200
{- "id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
- "priority": 3,
- "request": {
- "headers": {
- "Accept": {
- "equalTo": "text/plain"
}
}, - "method": "GET",
- "url": "/some/thing"
}, - "response": {
- "body": "Hello world!",
- "headers": {
- "Content-Type": "text/plain"
}, - "status": 200
}
}
findStubMappingsByMetadata
Find stubs by matching on their metadata
Request Body schema: application/jsonrequired
equalTo required | string |
caseInsensitive | boolean |
Responses
Request samples
- Payload
{- "matchesJsonPath": {
- "expression": "$.outer",
- "equalToJson": "{ \"inner\": 42 }"
}
}
Response samples
- 200
{- "meta": {
- "total": 2
}, - "mappings": [
- {
- "id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
- "uuid": "76ada7b0-49ae-4229-91c4-396a36f18e09",
- "request": {
- "method": "GET",
- "url": "/search?q=things",
- "headers": {
- "Accept": {
- "equalTo": "application/json"
}
}
}, - "response": {
- "status": 200,
- "jsonBody": [
- "thing1",
- "thing2"
], - "headers": {
- "Content-Type": "application/json"
}
}
}, - {
- "request": {
- "method": "POST",
- "urlPath": "/some/things",
- "bodyPatterns": [
- {
- "equalToXml": "<stuff />"
}
]
}, - "response": {
- "status": 201
}
}
]
}
Get all requests in journal
query Parameters
limit | string Example: limit=10 The maximum number of results to return |
since | string Example: since=2016-10-05T12:33:01Z Only return logged requests after this date |
Responses
Response samples
- 200
{- "requests": [
- {
- "id": "45760a03-eebb-4387-ad0d-bb89b5d3d662",
- "request": {
- "url": "/received-request/9",
- "method": "GET",
- "clientIp": "127.0.0.1",
- "headers": {
- "Connection": "keep-alive",
- "Host": "localhost:56715",
- "User-Agent": "Apache-HttpClient/4.5.1 (Java/1.7.0_51)"
}, - "cookies": { },
- "browserProxyRequest": false,
- "loggedDate": 1471442494809,
- "bodyAsBase64": "",
- "body": "",
- "loggedDateString": "2016-08-17T14:01:34Z"
}, - "responseDefinition": {
- "status": 404,
- "transformers": [ ],
- "fromConfiguredStub": false,
- "transformerParameters": { }
}
}, - {
- "id": "6ae78311-0178-46c9-987a-fbfc528d54d8",
- "request": {
- "url": "/received-request/8",
- "method": "GET",
- "clientIp": "127.0.0.1",
- "headers": {
- "Connection": "keep-alive",
- "Host": "localhost:56715",
- "User-Agent": "Apache-HttpClient/4.5.1 (Java/1.7.0_51)"
}, - "cookies": { },
- "browserProxyRequest": false,
- "loggedDate": 1471442494802,
- "bodyAsBase64": "",
- "body": "",
- "loggedDateString": "2016-08-17T14:01:34Z"
}, - "responseDefinition": {
- "status": 404,
- "transformers": [ ],
- "fromConfiguredStub": false,
- "transformerParameters": { }
}
}, - {
- "id": "aba8e4ad-1b5b-4518-8f05-b2170a24de35",
- "request": {
- "url": "/received-request/7",
- "method": "GET",
- "clientIp": "127.0.0.1",
- "headers": {
- "Connection": "keep-alive",
- "Host": "localhost:56715",
- "User-Agent": "Apache-HttpClient/4.5.1 (Java/1.7.0_51)"
}, - "cookies": { },
- "browserProxyRequest": false,
- "loggedDate": 1471442494795,
- "bodyAsBase64": "",
- "body": "",
- "loggedDateString": "2016-08-17T14:01:34Z"
}, - "responseDefinition": {
- "status": 404,
- "transformers": [ ],
- "fromConfiguredStub": false,
- "transformerParameters": { }
}
}
], - "meta": {
- "total": 9
}, - "requestJournalDisabled": false
}
Get request by ID
path Parameters
requestId required | string Example: 12fb14bb-600e-4bfa-bd8d-be7f12562c99 The UUID of the logged request |
Responses
Response samples
- 200
{- "id": "12fb14bb-600e-4bfa-bd8d-be7f12562c99",
- "request": {
- "url": "/received-request/2",
- "method": "GET",
- "clientIp": "127.0.0.1",
- "headers": {
- "Connection": "keep-alive",
- "Host": "localhost:56738",
- "User-Agent": "Apache-HttpClient/4.5.1 (Java/1.7.0_51)"
}, - "cookies": { },
- "browserProxyRequest": false,
- "loggedDate": 1471442557047,
- "bodyAsBase64": "",
- "body": "",
- "loggedDateString": "2016-08-17T14:02:37Z"
}, - "responseDefinition": {
- "status": 404,
- "transformers": [ ],
- "fromConfiguredStub": false,
- "transformerParameters": { }
}
}
Count requests by criteria
Count requests logged in the journal matching the specified criteria
Request Body schema: application/jsonrequired
scheme | string Enum: "http" "https" The scheme (protocol) part of the request URL |
host | string The hostname part of the request URL |
port | integer [ 1 .. 65535 ] The HTTP port number of the request URL |
method | string^[A-Z]+$ The HTTP request method e.g. GET |
url | string The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified. |
urlPath | string The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified. |
urlPathPattern | string The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified. |
urlPattern | string The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified. |
object Path parameter patterns to match against in the | |
object Query parameter patterns to match against in the | |
object application/x-www-form-urlencoded form parameter patterns to match against in the | |
object Header patterns to match against in the | |
object Pre-emptive basic auth credentials to match against | |
object Cookie patterns to match against in the | |
Array of String equals (object) or Binary equals (object) or String contains (object) or String does not contain (object) or Regular expression match (object) or Negative regular expression match (object) or NOT modifier (object) or Before datetime (object) or Before datetime (object) or Before datetime (object) or JSON equals (object) or JSONPath match (object) or XML equality (object) or XPath match (object) or JSON Schema match (object) or Absent matcher (object) or Logical AND matcher (object) or Logical AND matcher (object) or Has exactly multi value matcher (object) or Has exactly multi value matcher (object) (Content pattern) Request body patterns to match against in the | |
object Custom request matcher to match against | |
Array of objects Multipart patterns to match against headers and body. |
Responses
Request samples
- Payload
{- "method": "POST",
- "url": "/resource",
- "headers": {
- "Content-Type": {
- "matches": ".*/xml"
}
}
}
Response samples
- 200
{- "count": 4
}
Remove requests by criteria
Removed requests logged in the journal matching the specified criteria
Request Body schema: application/jsonrequired
scheme | string Enum: "http" "https" The scheme (protocol) part of the request URL |
host | string The hostname part of the request URL |
port | integer [ 1 .. 65535 ] The HTTP port number of the request URL |
method | string^[A-Z]+$ The HTTP request method e.g. GET |
url | string The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified. |
urlPath | string The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified. |
urlPathPattern | string The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified. |
urlPattern | string The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified. |
object Path parameter patterns to match against in the | |
object Query parameter patterns to match against in the | |
object application/x-www-form-urlencoded form parameter patterns to match against in the | |
object Header patterns to match against in the | |
object Pre-emptive basic auth credentials to match against | |
object Cookie patterns to match against in the | |
Array of String equals (object) or Binary equals (object) or String contains (object) or String does not contain (object) or Regular expression match (object) or Negative regular expression match (object) or NOT modifier (object) or Before datetime (object) or Before datetime (object) or Before datetime (object) or JSON equals (object) or JSONPath match (object) or XML equality (object) or XPath match (object) or JSON Schema match (object) or Absent matcher (object) or Logical AND matcher (object) or Logical AND matcher (object) or Has exactly multi value matcher (object) or Has exactly multi value matcher (object) (Content pattern) Request body patterns to match against in the | |
object Custom request matcher to match against | |
Array of objects Multipart patterns to match against headers and body. |
Responses
Request samples
- Payload
{- "method": "POST",
- "url": "/resource",
- "headers": {
- "Content-Type": {
- "matches": ".*/xml"
}
}
}
Response samples
- 200
{- "requests": [
- {
- "url": "/my/url",
- "method": "GET",
- "headers": {
- "Accept-Language": "en-us,en;q=0.5",
- "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20100101 Firefox/9.0",
- "Accept": "image/png,image/*;q=0.8,*/*;q=0.5"
}, - "body": "",
- "browserProxyRequest": true,
- "loggedDate": 1339083581823,
- "loggedDateString": "2012-06-07 16:39:41"
}, - {
- "url": "/my/other/url",
- "method": "POST",
- "headers": {
- "Accept": "text/plain",
- "Content-Type": "text/plain"
}, - "body": "My text",
- "browserProxyRequest": false,
- "loggedDate": 1339083581823,
- "loggedDateString": "2012-06-07 16:39:41"
}
]
}
Delete requests mappings matching metadata
Request Body schema: application/json
equalTo required | string |
caseInsensitive | boolean |
Responses
Request samples
- Payload
{- "matchesJsonPath": {
- "expression": "$.outer",
- "equalToJson": "{ \"inner\": 42 }"
}
}
Response samples
- 200
{- "requests": [
- {
- "url": "/my/url",
- "method": "GET",
- "headers": {
- "Accept-Language": "en-us,en;q=0.5",
- "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20100101 Firefox/9.0",
- "Accept": "image/png,image/*;q=0.8,*/*;q=0.5"
}, - "body": "",
- "browserProxyRequest": true,
- "loggedDate": 1339083581823,
- "loggedDateString": "2012-06-07 16:39:41"
}, - {
- "url": "/my/other/url",
- "method": "POST",
- "headers": {
- "Accept": "text/plain",
- "Content-Type": "text/plain"
}, - "body": "My text",
- "browserProxyRequest": false,
- "loggedDate": 1339083581823,
- "loggedDateString": "2012-06-07 16:39:41"
}
]
}
Find requests by criteria
Retrieve details of requests logged in the journal matching the specified criteria
Request Body schema: application/jsonrequired
scheme | string Enum: "http" "https" The scheme (protocol) part of the request URL |
host | string The hostname part of the request URL |
port | integer [ 1 .. 65535 ] The HTTP port number of the request URL |
method | string^[A-Z]+$ The HTTP request method e.g. GET |
url | string The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified. |
urlPath | string The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified. |
urlPathPattern | string The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified. |
urlPattern | string The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified. |
object Path parameter patterns to match against in the | |
object Query parameter patterns to match against in the | |
object application/x-www-form-urlencoded form parameter patterns to match against in the | |
object Header patterns to match against in the | |
object Pre-emptive basic auth credentials to match against | |
object Cookie patterns to match against in the | |
Array of String equals (object) or Binary equals (object) or String contains (object) or String does not contain (object) or Regular expression match (object) or Negative regular expression match (object) or NOT modifier (object) or Before datetime (object) or Before datetime (object) or Before datetime (object) or JSON equals (object) or JSONPath match (object) or XML equality (object) or XPath match (object) or JSON Schema match (object) or Absent matcher (object) or Logical AND matcher (object) or Logical AND matcher (object) or Has exactly multi value matcher (object) or Has exactly multi value matcher (object) (Content pattern) Request body patterns to match against in the | |
object Custom request matcher to match against | |
Array of objects Multipart patterns to match against headers and body. |
Responses
Request samples
- Payload
{- "method": "POST",
- "url": "/resource",
- "headers": {
- "Content-Type": {
- "matches": ".*/xml"
}
}
}
Response samples
- 200
{- "requests": [
- {
- "url": "/my/url",
- "method": "GET",
- "headers": {
- "Accept-Language": "en-us,en;q=0.5",
- "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20100101 Firefox/9.0",
- "Accept": "image/png,image/*;q=0.8,*/*;q=0.5"
}, - "body": "",
- "browserProxyRequest": true,
- "loggedDate": 1339083581823,
- "loggedDateString": "2012-06-07 16:39:41"
}, - {
- "url": "/my/other/url",
- "method": "POST",
- "headers": {
- "Accept": "text/plain",
- "Content-Type": "text/plain"
}, - "body": "My text",
- "browserProxyRequest": false,
- "loggedDate": 1339083581823,
- "loggedDateString": "2012-06-07 16:39:41"
}
]
}
Find unmatched requests
Get details of logged requests that weren't matched by any stub mapping
Responses
Response samples
- 200
{- "requests": [
- {
- "url": "/my/url",
- "method": "GET",
- "headers": {
- "Accept-Language": "en-us,en;q=0.5",
- "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20100101 Firefox/9.0",
- "Accept": "image/png,image/*;q=0.8,*/*;q=0.5"
}, - "body": "",
- "browserProxyRequest": true,
- "loggedDate": 1339083581823,
- "loggedDateString": "2012-06-07 16:39:41"
}, - {
- "url": "/my/other/url",
- "method": "POST",
- "headers": {
- "Accept": "text/plain",
- "Content-Type": "text/plain"
}, - "body": "My text",
- "browserProxyRequest": false,
- "loggedDate": 1339083581823,
- "loggedDateString": "2012-06-07 16:39:41"
}
]
}
Near misses allow querying of received requests or request patterns according to similarity
Response samples
- 200
{- "nearMisses": [
- {
- "request": {
- "url": "/nomatch",
- "method": "GET",
- "clientIp": "0:0:0:0:0:0:0:1",
- "headers": {
- "User-Agent": "curl/7.30.0",
- "Accept": "*/*",
- "Host": "localhost:8080"
}, - "cookies": { },
- "browserProxyRequest": false,
- "loggedDate": 1467402464520,
- "bodyAsBase64": "",
- "body": "",
- "loggedDateString": "2016-07-01T19:47:44Z"
}, - "requestPattern": {
- "url": "/almostmatch",
- "method": "GET"
}, - "matchResult": {
- "distance": 0.06944444444444445
}
}
]
}
Find near misses matching specific request
Find at most 3 near misses for closest stub mappings to the specified request
Request Body schema: application/jsonrequired
method | string The HTTP request method |
url | string The path and query to match exactly against |
absoluteUrl | string The full URL to match against |
headers | object Header patterns to match against in the |
cookies | object Cookie patterns to match against in the |
body | string Body string to match against |
Responses
Request samples
- Payload
{- "url": "/actual",
- "method": "GET",
- "clientIp": "0:0:0:0:0:0:0:1",
- "headers": {
- "User-Agent": "curl/7.30.0",
- "Accept": "*/*",
- "Host": "localhost:8080"
}, - "cookies": { },
- "browserProxyRequest": false,
- "loggedDate": 1467402464520,
- "bodyAsBase64": "",
- "body": "",
- "loggedDateString": "2016-07-01T19:47:44Z"
}
Response samples
- 200
{- "nearMisses": [
- {
- "request": {
- "url": "/nomatch",
- "method": "GET",
- "clientIp": "0:0:0:0:0:0:0:1",
- "headers": {
- "User-Agent": "curl/7.30.0",
- "Accept": "*/*",
- "Host": "localhost:8080"
}, - "cookies": { },
- "browserProxyRequest": false,
- "loggedDate": 1467402464520,
- "bodyAsBase64": "",
- "body": "",
- "loggedDateString": "2016-07-01T19:47:44Z"
}, - "requestPattern": {
- "url": "/almostmatch",
- "method": "GET"
}, - "matchResult": {
- "distance": 0.06944444444444445
}
}
]
}
Find near misses matching request pattern
Find at most 3 near misses for closest logged requests to the specified request pattern
Request Body schema: application/jsonrequired
scheme | string Enum: "http" "https" The scheme (protocol) part of the request URL |
host | string The hostname part of the request URL |
port | integer [ 1 .. 65535 ] The HTTP port number of the request URL |
method | string^[A-Z]+$ The HTTP request method e.g. GET |
url | string The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified. |
urlPath | string The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified. |
urlPathPattern | string The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified. |
urlPattern | string The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified. |
object Path parameter patterns to match against in the | |
object Query parameter patterns to match against in the | |
object application/x-www-form-urlencoded form parameter patterns to match against in the | |
object Header patterns to match against in the | |
object Pre-emptive basic auth credentials to match against | |
object Cookie patterns to match against in the | |
Array of String equals (object) or Binary equals (object) or String contains (object) or String does not contain (object) or Regular expression match (object) or Negative regular expression match (object) or NOT modifier (object) or Before datetime (object) or Before datetime (object) or Before datetime (object) or JSON equals (object) or JSONPath match (object) or XML equality (object) or XPath match (object) or JSON Schema match (object) or Absent matcher (object) or Logical AND matcher (object) or Logical AND matcher (object) or Has exactly multi value matcher (object) or Has exactly multi value matcher (object) (Content pattern) Request body patterns to match against in the | |
object Custom request matcher to match against | |
Array of objects Multipart patterns to match against headers and body. |
Responses
Request samples
- Payload
{- "method": "POST",
- "url": "/resource",
- "headers": {
- "Content-Type": {
- "matches": ".*/xml"
}
}
}
Response samples
- 200
{- "nearMisses": [
- {
- "request": {
- "url": "/nomatch",
- "method": "GET",
- "clientIp": "0:0:0:0:0:0:0:1",
- "headers": {
- "User-Agent": "curl/7.30.0",
- "Accept": "*/*",
- "Host": "localhost:8080"
}, - "cookies": { },
- "browserProxyRequest": false,
- "loggedDate": 1467402464520,
- "bodyAsBase64": "",
- "body": "",
- "loggedDateString": "2016-07-01T19:47:44Z"
}, - "requestPattern": {
- "url": "/almostmatch",
- "method": "GET"
}, - "matchResult": {
- "distance": 0.06944444444444445
}
}
]
}
Start recording
Begin recording stub mappings
Request Body schema: application/jsonrequired
object Headers from the request to include in the generated stub mappings, mapped to parameter objects. The only parameter available is "caseInsensitive", which defaults to false | |
object Criteria for extracting response bodies to a separate file instead of including it in the stub mapping | |
persist | boolean Default: true Whether to save stub mappings to the file system or just return them |
repeatsAsScenarios | boolean Default: true When true, duplicate requests will be added to a Scenario. When false, duplicates are discarded |
object or object or object or object Control the request body matcher used in generated stub mappings | |
transformerParameters | object List of names of stub mappings transformers to apply to generated stubs |
transformers | Array of strings Parameters to pass to stub mapping transformers |
object Filter requests for which to create stub mapping | |
targetBaseUrl | string Target URL when using the record and playback API |
Responses
Request samples
- Payload
{- "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"
}
}
Response samples
- 200
{- "mappings": [
- {
- "id": "093f1027-e5e0-4921-9e6d-e619dfd5d2c7",
- "name": "recordables_123",
- "request": {
- "url": "/recordables/123",
- "method": "GET"
}, - "response": {
- "status": 200,
- "body": "{\n \"message\": \"Congratulations on your first recording!\"\n}",
- "headers": {
- "Content-Type": "application/json"
}
}, - "uuid": "093f1027-e5e0-4921-9e6d-e619dfd5d2c7",
- "persistent": true
}
]
}
Take a snapshot recording
Request Body schema: application/jsonrequired
object Headers from the request to include in the generated stub mappings, mapped to parameter objects. The only parameter available is "caseInsensitive", which defaults to false | |
object Criteria for extracting response bodies to a separate file instead of including it in the stub mapping | |
persist | boolean Default: true Whether to save stub mappings to the file system or just return them |
repeatsAsScenarios | boolean Default: true When true, duplicate requests will be added to a Scenario. When false, duplicates are discarded |
object or object or object or object Control the request body matcher used in generated stub mappings | |
transformerParameters | object List of names of stub mappings transformers to apply to generated stubs |
transformers | Array of strings Parameters to pass to stub mapping transformers |
object Filter requests for which to create stub mapping |
Responses
Request samples
- Payload
{- "filters": {
- "urlPathPattern": "/api/.*",
- "method": "GET",
- "ids": [
- "40a93c4a-d378-4e07-8321-6158d5dbcb29"
]
}, - "captureHeaders": {
- "Accept": { },
- "Content-Type": {
- "caseInsensitive": true
}
}, - "requestBodyPattern": {
- "matcher": "equalToJson",
- "ignoreArrayOrder": false,
- "ignoreExtraElements": true
}, - "extractBodyCriteria": {
- "textSizeThreshold": "2 kb",
- "binarySizeThreshold": "1 Mb"
}, - "outputFormat": "FULL",
- "persist": false,
- "repeatsAsScenarios": false,
- "transformers": [
- "modify-response-header"
], - "transformerParameters": {
- "headerValue": "123"
}
}
Response samples
- 200
{- "mappings": [
- {
- "id": "093f1027-e5e0-4921-9e6d-e619dfd5d2c7",
- "name": "recordables_123",
- "request": {
- "url": "/recordables/123",
- "method": "GET"
}, - "response": {
- "status": 200,
- "body": "{\n \"message\": \"Congratulations on your first recording!\"\n}",
- "headers": {
- "Content-Type": "application/json"
}
}, - "uuid": "093f1027-e5e0-4921-9e6d-e619dfd5d2c7",
- "persistent": true
}
]
}