/__admin/mappings
Stub mappings
Get all stub mappings
Create a new stub mapping
Delete all stub mappings
get /__admin/mappings
Get all stub mappings
Query Parameters
- Query limit: (number)
The maximum number of results to return
Example:
10
- Query offset: (number)
The start index of the results to return
Example:
25
HTTP status code 200
All stub mappings
Body
Type: application/json
Schema:
{
"type": "object",
"properties": {
"mappings": {
"$ref": "stub-mapping.schema.json"
},
"meta": {
"type": "object",
"properties": {
"total": {
"type": "integer"
}
},
"required": [
"total"
]
}
}
}
Example:
{
"mappings": [ {
"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
}
} ],
"meta": {
"total": 2
}
}
post /__admin/mappings
Create a new stub mapping
Body
Type: application/json
Schema:
{
"type": "object",
"properties": {
"id": {
"description": "This stub mapping's unique identifier",
"type": "string"
},
"priority": {
"description": "This stub mapping's priority relative to others. 1 is highest.",
"type": "integer",
"minimum": 1
},
"persistent": {
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default.",
"type": "boolean"
},
"scenarioName": {
"descrption": "The name of the scenario that this stub mapping is part of",
"type": "string"
},
"requiredScenarioState": {
"descrption": "The required state of the scenario in order for this stub to be matched.",
"type": "string"
},
"newScenarioState": {
"descrption": "The new state for the scenario to be updated to after this stub is served.",
"type": "string"
},
"postServeActions": {
"descrption": "A map of the names of post serve action extensions to trigger and their parameters.",
"type": "object"
},
"request": {
"$ref": "request-pattern.schema.json"
},
"response": {
"$ref": "response-definition.schema.json"
}
},
"example": {
"id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"priority": 3,
"request": {
"method": "GET",
"url": "/some/thing",
"headers": {
"Accept": "text/plain"
}
},
"response": {
"status": 200,
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
}
}
}
}
Example:
{
"request": {
"method": "GET",
"url": "/some/thing"
},
"response": {
"status": 200,
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
}
}
}
HTTP status code 201
Successfully created
Body
Type: application/json
Schema:
{
"type": "object",
"properties": {
"id": {
"description": "This stub mapping's unique identifier",
"type": "string"
},
"priority": {
"description": "This stub mapping's priority relative to others. 1 is highest.",
"type": "integer",
"minimum": 1
},
"persistent": {
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default.",
"type": "boolean"
},
"scenarioName": {
"descrption": "The name of the scenario that this stub mapping is part of",
"type": "string"
},
"requiredScenarioState": {
"descrption": "The required state of the scenario in order for this stub to be matched.",
"type": "string"
},
"newScenarioState": {
"descrption": "The new state for the scenario to be updated to after this stub is served.",
"type": "string"
},
"postServeActions": {
"descrption": "A map of the names of post serve action extensions to trigger and their parameters.",
"type": "object"
},
"request": {
"$ref": "request-pattern.schema.json"
},
"response": {
"$ref": "response-definition.schema.json"
}
},
"example": {
"id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"priority": 3,
"request": {
"method": "GET",
"url": "/some/thing",
"headers": {
"Accept": "text/plain"
}
},
"response": {
"status": 200,
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
}
}
}
}
Example:
{
"id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"uuid": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"request": {
"method": "GET",
"url": "/some/thing"
},
"response": {
"status": 200,
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
}
}
}
Stub mappings
Reset stub mappings (restore to defaults defined back the backing store)
Single stub mapping
Get a single stub mapping
Update an existing stub mapping
Delete a stub mapping
get /__admin/mappings/{stubMappingId}
Get a single stub mapping
URI Parameters
- Stub mapping ID: required (string)
The UUID of stub mapping
Example:
730d3e32-d098-4169-a20c-554c3bedce58
HTTP status code 200
Body
Type: application/json
Schema:
{
"type": "object",
"properties": {
"id": {
"description": "This stub mapping's unique identifier",
"type": "string"
},
"priority": {
"description": "This stub mapping's priority relative to others. 1 is highest.",
"type": "integer",
"minimum": 1
},
"persistent": {
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default.",
"type": "boolean"
},
"scenarioName": {
"descrption": "The name of the scenario that this stub mapping is part of",
"type": "string"
},
"requiredScenarioState": {
"descrption": "The required state of the scenario in order for this stub to be matched.",
"type": "string"
},
"newScenarioState": {
"descrption": "The new state for the scenario to be updated to after this stub is served.",
"type": "string"
},
"postServeActions": {
"descrption": "A map of the names of post serve action extensions to trigger and their parameters.",
"type": "object"
},
"request": {
"$ref": "request-pattern.schema.json"
},
"response": {
"$ref": "response-definition.schema.json"
}
},
"example": {
"id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"priority": 3,
"request": {
"method": "GET",
"url": "/some/thing",
"headers": {
"Accept": "text/plain"
}
},
"response": {
"status": 200,
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
}
}
}
}
Example:
{
"id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"uuid": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"request": {
"method": "GET",
"url": "/some/thing"
},
"response": {
"status": 200,
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
}
}
}
put /__admin/mappings/{stubMappingId}
Update an existing stub mapping
URI Parameters
- Stub mapping ID: required (string)
The UUID of stub mapping
Example:
730d3e32-d098-4169-a20c-554c3bedce58
Body
Type: application/json
Schema:
{
"type": "object",
"properties": {
"id": {
"description": "This stub mapping's unique identifier",
"type": "string"
},
"priority": {
"description": "This stub mapping's priority relative to others. 1 is highest.",
"type": "integer",
"minimum": 1
},
"persistent": {
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default.",
"type": "boolean"
},
"scenarioName": {
"descrption": "The name of the scenario that this stub mapping is part of",
"type": "string"
},
"requiredScenarioState": {
"descrption": "The required state of the scenario in order for this stub to be matched.",
"type": "string"
},
"newScenarioState": {
"descrption": "The new state for the scenario to be updated to after this stub is served.",
"type": "string"
},
"postServeActions": {
"descrption": "A map of the names of post serve action extensions to trigger and their parameters.",
"type": "object"
},
"request": {
"$ref": "request-pattern.schema.json"
},
"response": {
"$ref": "response-definition.schema.json"
}
},
"example": {
"id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"priority": 3,
"request": {
"method": "GET",
"url": "/some/thing",
"headers": {
"Accept": "text/plain"
}
},
"response": {
"status": 200,
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
}
}
}
}
Example:
{
"request": {
"method": "GET",
"url": "/some/thing"
},
"response": {
"status": 200,
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
}
}
}
HTTP status code 200
Body
Type: application/json
Schema:
{
"type": "object",
"properties": {
"id": {
"description": "This stub mapping's unique identifier",
"type": "string"
},
"priority": {
"description": "This stub mapping's priority relative to others. 1 is highest.",
"type": "integer",
"minimum": 1
},
"persistent": {
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default.",
"type": "boolean"
},
"scenarioName": {
"descrption": "The name of the scenario that this stub mapping is part of",
"type": "string"
},
"requiredScenarioState": {
"descrption": "The required state of the scenario in order for this stub to be matched.",
"type": "string"
},
"newScenarioState": {
"descrption": "The new state for the scenario to be updated to after this stub is served.",
"type": "string"
},
"postServeActions": {
"descrption": "A map of the names of post serve action extensions to trigger and their parameters.",
"type": "object"
},
"request": {
"$ref": "request-pattern.schema.json"
},
"response": {
"$ref": "response-definition.schema.json"
}
},
"example": {
"id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"priority": 3,
"request": {
"method": "GET",
"url": "/some/thing",
"headers": {
"Accept": "text/plain"
}
},
"response": {
"status": 200,
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
}
}
}
}
Example:
{
"id": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"uuid": "76ada7b0-49ae-4229-91c4-396a36f18e09",
"request": {
"method": "GET",
"url": "/some/thing"
},
"response": {
"status": 200,
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
}
}
}
Stub mappings
Save all persistent stub mappings to the backing store
/__admin/requests
Logged requests and responses received by the mock service
Get received requests
Delete all received requests
get /__admin/requests
Get received requests
Query Parameters
- Query limit: (string)
The maximum number of results to return
Example:
10
- Since date: (string)
Only return logged requests after this date
Example:
Wed Oct 05 2016 13:33:01 GMT+0100 (BST)
HTTP status code 200
Body
Type: application/json
Example:
{
"requests" : [ {
"id" : "45760a03-eebb-4387-ad0d-bb89b5d3d662",
"request" : {
"url" : "/received-request/9",
"absoluteUrl" : "http://localhost:56715/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",
"absoluteUrl" : "http://localhost:56715/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",
"absoluteUrl" : "http://localhost:56715/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
}
Single logged request
get /__admin/requests/{requestId}
URI Parameters
- Request ID: required (string)
The UUID of the logged request
Example:
12fb14bb-600e-4bfa-bd8d-be7f12562c99
HTTP status code 200
Body
Type: application/json
Example:
{
"id" : "12fb14bb-600e-4bfa-bd8d-be7f12562c99",
"request" : {
"url" : "/received-request/2",
"absoluteUrl" : "http://localhost:56738/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" : { }
}
}
Request journal
Empty the request journal
Request journal
Count requests logged in the journal matching the specified criteria
post /__admin/requests/count
Count requests logged in the journal matching the specified criteria
Body
Type: application/json
Schema:
{
"type": "object",
"properties": {
"url": {
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPattern": {
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPath": {
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPathPattern": {
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"method": {
"description": "The HTTP request method e.g. GET",
"type": "string"
},
"headers": {
"description": "Header patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"queryParameters": {
"description": "Query parameter patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"cookies": {
"description": "Cookie patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"bodyPatterns": {
"description": "Request body patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "array",
"items": {
"type": "object"
}
},
"basicAuthCredentials": {
"description": "Pre-emptive basic auth credentials to match against",
"type": "object",
"properties": {
"username": {
"type": "string"
},
"password": {
"type": "string"
}
},
"required": [
"username",
"password"
]
}
},
"example": {
"method": "POST",
"url": "/some/thing",
"headers": {
"Content-Type": "application/json"
},
"bodyPatterns": [
{ "equalToJson": "{ \"numbers\": [1, 2, 3] }" }
]
}
}
Example:
{
"method": "POST",
"url": "/resource/to/count",
"headers": {
"Content-Type": {
"matches": ".*/xml"
}
}
}
Retrieve details of requests logged in the journal matching the specified criteria
post /__admin/requests/find
Retrieve details of requests logged in the journal matching the specified criteria
Body
Type: application/json
Schema:
{
"type": "object",
"properties": {
"url": {
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPattern": {
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPath": {
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPathPattern": {
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"method": {
"description": "The HTTP request method e.g. GET",
"type": "string"
},
"headers": {
"description": "Header patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"queryParameters": {
"description": "Query parameter patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"cookies": {
"description": "Cookie patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"bodyPatterns": {
"description": "Request body patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "array",
"items": {
"type": "object"
}
},
"basicAuthCredentials": {
"description": "Pre-emptive basic auth credentials to match against",
"type": "object",
"properties": {
"username": {
"type": "string"
},
"password": {
"type": "string"
}
},
"required": [
"username",
"password"
]
}
},
"example": {
"method": "POST",
"url": "/some/thing",
"headers": {
"Content-Type": "application/json"
},
"bodyPatterns": [
{ "equalToJson": "{ \"numbers\": [1, 2, 3] }" }
]
}
}
Example:
{
"method": "POST",
"url": "/resource/to/count",
"headers": {
"Content-Type": {
"matches": ".*/xml"
}
}
}
HTTP status code 200
Matching request details
Body
Type: application/json
Example:
{
"requests": [
{
"url": "/my/url",
"absoluteUrl": "http://mydomain.com/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",
"absoluteUrl": "http://my.other.domain.com/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"
}
]
}
Get details of logged requests that weren't matched by any stub mapping
get /__admin/requests/unmatched
Get details of logged requests that weren't matched by any stub mapping
HTTP status code 200
Unmatched request details
Body
Type: application/json
Example:
{
"requests": [
{
"url": "/my/url",
"absoluteUrl": "http://mydomain.com/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",
"absoluteUrl": "http://my.other.domain.com/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"
}
]
}
Retrieve near-misses for all unmatched requests
get /__admin/requests/unmatched/near-misses
Retrieve near-misses for all unmatched requests
HTTP status code 200
Top 3 (at most) near misses for each unmatched request
Body
Type: application/json
Example:
{
"nearMisses": [
{
"request": {
"url": "/nomatch",
"absoluteUrl": "http://localhost:8080/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
}
}
]
}
/__admin/recordings
Stub mapping record and snapshot functions
Start recording stub mappings
Start recording stub mappings
post /__admin/recordings/start
Start recording stub mappings
Body
Type: application/json
Schema:
{
"type": "object",
"properties": {
"targetBaseUrl": {
"type": "string"
},
"captureHeaders": {
"type": "object"
},
"extractBodyCriteria": {
"type": "object",
"properties": {
"binarySizeThreshold": {
"type": "string"
},
"textSizeThreshold": {
"type": "string"
}
}
},
"requestBodyPattern": {
"type": "object",
"properties": {
"matcher": {
"type": "string",
"enum": [
"equalTo",
"equalToJson",
"equalToXml",
"auto"
]
},
"ignoreArrayOrder": {
"type": "boolean"
},
"ignoreExtraElements": {
"type": "boolean"
},
"caseInsensitive": {
"type": "boolean"
}
}
},
"filters": {
"type": "object",
"properties": {
"ids": {
"type": "array",
"items": {
"type": "string"
}
},
"method": {
"type": "string"
},
"urlPathPattern": {
"type": "string"
}
}
},
"persist": {
"type": "boolean"
},
"repeatsAsScenarios": {
"type": "boolean"
},
"transformerParameters": {
"type": "object",
"properties": {
"headerValue": {
"type": "string"
}
}
},
"transformers": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
Example:
{
"targetBaseUrl" : "http://example.wiremockapi.cloud",
"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"
}
}
HTTP status code 200
Successfully started recording
Stop recording stub mappings
Stop recording stub mappings
post /__admin/recordings/stop
Stop recording stub mappings
HTTP status code 200
Successfully started recording
Body
Type: application/json
Schema:
{
"type": "object",
"properties": {
"mappings": {
"$ref": "stub-mapping.schema.json"
},
"meta": {
"type": "object",
"properties": {
"total": {
"type": "integer"
}
},
"required": [
"total"
]
}
}
}
Example:
{
"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
} ]
}
Recording status
Get the recording status (started or stopped)
Snapshot recording
Take a snapshot recording
post /__admin/recordings/snapshot
Take a snapshot recording
Body
Type: application/json
Schema:
{
"type": "object",
"properties": {
"targetBaseUrl": {
"type": "string"
},
"captureHeaders": {
"type": "object"
},
"extractBodyCriteria": {
"type": "object",
"properties": {
"binarySizeThreshold": {
"type": "string"
},
"textSizeThreshold": {
"type": "string"
}
}
},
"requestBodyPattern": {
"type": "object",
"properties": {
"matcher": {
"type": "string",
"enum": [
"equalTo",
"equalToJson",
"equalToXml",
"auto"
]
},
"ignoreArrayOrder": {
"type": "boolean"
},
"ignoreExtraElements": {
"type": "boolean"
},
"caseInsensitive": {
"type": "boolean"
}
}
},
"filters": {
"type": "object",
"properties": {
"ids": {
"type": "array",
"items": {
"type": "string"
}
},
"method": {
"type": "string"
},
"urlPathPattern": {
"type": "string"
}
}
},
"persist": {
"type": "boolean"
},
"repeatsAsScenarios": {
"type": "boolean"
},
"transformerParameters": {
"type": "object",
"properties": {
"headerValue": {
"type": "string"
}
}
},
"transformers": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
Example:
{
"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"
}
}
HTTP status code 200
Successfully took a snapshot recording
Body
Type: application/json
Schema:
{
"type": "object",
"properties": {
"mappings": {
"$ref": "stub-mapping.schema.json"
},
"meta": {
"type": "object",
"properties": {
"total": {
"type": "integer"
}
},
"required": [
"total"
]
}
}
}
Example:
{
"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
} ]
}
/__admin/scenarios
Scenarios support modelling of stateful behaviour
Get all scenarios
get /__admin/scenarios
Get all scenarios
HTTP status code 200
All scenarios
Body
Type: application/json
Schema:
{
"type": "object",
"properties": {
"scenarios": {
"type": "array",
"items": {
"$ref": "scenario.schema.json"
}
}
}
}
Example:
{
"scenarios" : [ {
"id" : "c8d249ec-d86d-48b1-88a8-a660e6848042",
"name" : "my_scenario",
"state" : "Started",
"possibleStates" : [ "Started", "state_2", "state_3" ]
} ]
}
Scenarios
Reset the state of all scenarios
/__admin/near-misses
Near misses allow querying of received requests or request patterns according to similarity
Find at most 3 near misses for closest stub mappings to the specified request
post /__admin/near-misses/request
Find at most 3 near misses for closest stub mappings to the specified request
Body
Type: application/json
Example:
{
"url": "/actual",
"absoluteUrl": "http://localhost:8080/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"
}
HTTP status code 200
Near misses matching criteria
Body
Type: application/json
Example:
{
"nearMisses": [
{
"request": {
"url": "/nomatch",
"absoluteUrl": "http://localhost:8080/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
}
}
]
}
Near misses
Find at most 3 near misses for closest logged requests to the specified request pattern
post /__admin/near-misses/request-pattern
Find at most 3 near misses for closest logged requests to the specified request pattern
Body
Type: application/json
Schema:
{
"type": "object",
"properties": {
"url": {
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPattern": {
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPath": {
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"urlPathPattern": {
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified.",
"type": "string"
},
"method": {
"description": "The HTTP request method e.g. GET",
"type": "string"
},
"headers": {
"description": "Header patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"queryParameters": {
"description": "Query parameter patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"cookies": {
"description": "Cookie patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "object"
},
"bodyPatterns": {
"description": "Request body patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"type": "array",
"items": {
"type": "object"
}
},
"basicAuthCredentials": {
"description": "Pre-emptive basic auth credentials to match against",
"type": "object",
"properties": {
"username": {
"type": "string"
},
"password": {
"type": "string"
}
},
"required": [
"username",
"password"
]
}
},
"example": {
"method": "POST",
"url": "/some/thing",
"headers": {
"Content-Type": "application/json"
},
"bodyPatterns": [
{ "equalToJson": "{ \"numbers\": [1, 2, 3] }" }
]
}
}
Example:
{
"method": "POST",
"url": "/resource/to/count",
"headers": {
"Content-Type": {
"matches": ".*/xml"
}
}
}
HTTP status code 200
Near misses matching criteria
Body
Type: application/json
Example:
{
"nearMisses": [
{
"request": {
"url": "/nomatch",
"absoluteUrl": "http://localhost:8080/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
}
}
]
}
/__admin/settings
Global settings
Update global settings
/__admin/shutdown
Shutdown function
Shutdown the WireMock server