swagger.wiremock-admin-api.json Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wiremock Show documentation
Show all versions of wiremock Show documentation
A web service test double for all occasions
{
"openapi": "3.0.0",
"info": {
"title": "WireMock",
"version": "3.0.0-beta-14"
},
"externalDocs": {
"description": "WireMock user documentation",
"url": "http://wiremock.org/docs/"
},
"servers": [
{
"url": "/"
}
],
"tags": [
{
"name": "Stub Mappings",
"description": "Operations on stub mappings",
"externalDocs": {
"description": "User documentation",
"url": "http://wiremock.org/docs/stubbing/"
}
},
{
"name": "Requests",
"description": "Logged requests and responses received by the mock service",
"externalDocs": {
"description": "User documentation",
"url": "http://wiremock.org/docs/verifying/"
}
},
{
"name": "Near Misses",
"description": "Near misses allow querying of received requests or request patterns according to similarity",
"externalDocs": {
"description": "User documentation",
"url": "http://wiremock.org/docs/verifying/#near-misses"
}
},
{
"name": "Recordings",
"description": "Stub mapping record and snapshot functions",
"externalDocs": {
"description": "User documentation",
"url": "http://wiremock.org/docs/record-playback/"
}
},
{
"name": "Scenarios",
"description": "Scenarios support modelling of stateful behaviour",
"externalDocs": {
"description": "User documentation",
"url": "http://wiremock.org/docs/stateful-behaviour/"
}
},
{
"name": "System",
"description": "Global operations"
}
],
"paths": {
"/__admin/mappings": {
"get": {
"summary": "Get all stub mappings",
"tags": [
"Stub Mappings"
],
"parameters": [
{
"description": "The maximum number of results to return",
"in": "query",
"name": "limit",
"required": false,
"example": 10,
"schema": {
"type": "integer"
}
},
{
"description": "The start index of the results to return",
"in": "query",
"name": "offset",
"required": false,
"example": 0,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"mappings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This stub mapping's unique identifier"
},
"uuid": {
"type": "string",
"description": "Alias for the id"
},
"name": {
"type": "string",
"description": "The stub mapping's name"
},
"request": {
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
"response": {
"allOf": [
{
"type": "object",
"properties": {
"status": {
"type": "integer",
"description": "The HTTP status code to be returned"
},
"statusMessage": {
"type": "string",
"description": "The HTTP status message to be returned"
},
"headers": {
"type": "object",
"description": "Map of response headers to send"
},
"additionalProxyRequestHeaders": {
"type": "object",
"description": "Extra request headers to send when proxying to another host."
},
"body": {
"type": "string",
"description": "The response body as a string. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"base64Body": {
"type": "string",
"description": "The response body as a base64 encoded string (useful for binary content). Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"jsonBody": {
"type": "object",
"description": "The response body as a JSON object. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"bodyFileName": {
"type": "string",
"description": "The path to the file containing the response body, relative to the configured file root. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"fault": {
"type": "string",
"description": "The fault to apply (instead of a full, valid response).",
"enum": [
"CONNECTION_RESET_BY_PEER",
"EMPTY_RESPONSE",
"MALFORMED_RESPONSE_CHUNK",
"RANDOM_DATA_THEN_CLOSE"
]
},
"fixedDelayMilliseconds": {
"type": "integer",
"description": "Number of milliseconds to delay be before sending the response."
},
"delayDistribution": {
"description": "The delay distribution. Valid property configuration is either median/sigma/type or lower/type/upper.",
"oneOf": [
{
"title": "Log normal",
"description": "Log normal randomly distributed response delay.",
"type": "object",
"properties": {
"median": {
"type": "integer"
},
"sigma": {
"type": "number"
},
"type": {
"enum": [
"lognormal"
],
"type": "string"
}
}
},
{
"title": "Uniform",
"description": "Uniformly distributed random response delay.",
"type": "object",
"properties": {
"lower": {
"type": "integer"
},
"type": {
"enum": [
"uniform"
],
"type": "string"
},
"upper": {
"type": "integer"
}
}
}
]
},
"fromConfiguredStub": {
"type": "boolean",
"description": "Read-only flag indicating false if this was the default, unmatched response. Not present otherwise."
},
"proxyBaseUrl": {
"type": "string",
"description": "The base URL of the target to proxy matching requests to."
},
"transformerParameters": {
"type": "object",
"description": "Parameters to apply to response transformers."
},
"transformers": {
"type": "array",
"description": "List of names of transformers to apply to this response.",
"items": {
"type": "string"
}
}
}
}
]
},
"persistent": {
"type": "boolean",
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default."
},
"priority": {
"type": "integer",
"description": "This stub mapping's priority relative to others. 1 is highest.",
"minimum": 1
},
"scenarioName": {
"type": "string",
"description": "The name of the scenario that this stub mapping is part of"
},
"requiredScenarioState": {
"type": "string",
"description": "The required state of the scenario in order for this stub to be matched."
},
"newScenarioState": {
"type": "string",
"description": "The new state for the scenario to be updated to after this stub is served."
},
"postServeActions": {
"type": "object",
"description": "A map of the names of post serve action extensions to trigger and their parameters."
},
"metadata": {
"type": "object",
"description": "Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs."
}
},
"additionalProperties": false
}
},
"meta": {
"type": "object",
"properties": {
"total": {
"type": "integer",
"example": 4
}
},
"required": [
"total"
]
}
},
"additionalProperties": false
},
"example": {
"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": " "
}
]
},
"response": {
"status": 201
}
}
]
}
}
},
"description": "All stub mappings"
}
}
},
"post": {
"summary": "Create a new stub mapping",
"tags": [
"Stub Mappings"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This stub mapping's unique identifier"
},
"uuid": {
"type": "string",
"description": "Alias for the id"
},
"name": {
"type": "string",
"description": "The stub mapping's name"
},
"request": {
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
"response": {
"allOf": [
{
"type": "object",
"properties": {
"status": {
"type": "integer",
"description": "The HTTP status code to be returned"
},
"statusMessage": {
"type": "string",
"description": "The HTTP status message to be returned"
},
"headers": {
"type": "object",
"description": "Map of response headers to send"
},
"additionalProxyRequestHeaders": {
"type": "object",
"description": "Extra request headers to send when proxying to another host."
},
"body": {
"type": "string",
"description": "The response body as a string. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"base64Body": {
"type": "string",
"description": "The response body as a base64 encoded string (useful for binary content). Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"jsonBody": {
"type": "object",
"description": "The response body as a JSON object. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"bodyFileName": {
"type": "string",
"description": "The path to the file containing the response body, relative to the configured file root. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"fault": {
"type": "string",
"description": "The fault to apply (instead of a full, valid response).",
"enum": [
"CONNECTION_RESET_BY_PEER",
"EMPTY_RESPONSE",
"MALFORMED_RESPONSE_CHUNK",
"RANDOM_DATA_THEN_CLOSE"
]
},
"fixedDelayMilliseconds": {
"type": "integer",
"description": "Number of milliseconds to delay be before sending the response."
},
"delayDistribution": {
"description": "The delay distribution. Valid property configuration is either median/sigma/type or lower/type/upper.",
"oneOf": [
{
"title": "Log normal",
"description": "Log normal randomly distributed response delay.",
"type": "object",
"properties": {
"median": {
"type": "integer"
},
"sigma": {
"type": "number"
},
"type": {
"enum": [
"lognormal"
],
"type": "string"
}
}
},
{
"title": "Uniform",
"description": "Uniformly distributed random response delay.",
"type": "object",
"properties": {
"lower": {
"type": "integer"
},
"type": {
"enum": [
"uniform"
],
"type": "string"
},
"upper": {
"type": "integer"
}
}
}
]
},
"fromConfiguredStub": {
"type": "boolean",
"description": "Read-only flag indicating false if this was the default, unmatched response. Not present otherwise."
},
"proxyBaseUrl": {
"type": "string",
"description": "The base URL of the target to proxy matching requests to."
},
"transformerParameters": {
"type": "object",
"description": "Parameters to apply to response transformers."
},
"transformers": {
"type": "array",
"description": "List of names of transformers to apply to this response.",
"items": {
"type": "string"
}
}
}
}
]
},
"persistent": {
"type": "boolean",
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default."
},
"priority": {
"type": "integer",
"description": "This stub mapping's priority relative to others. 1 is highest.",
"minimum": 1
},
"scenarioName": {
"type": "string",
"description": "The name of the scenario that this stub mapping is part of"
},
"requiredScenarioState": {
"type": "string",
"description": "The required state of the scenario in order for this stub to be matched."
},
"newScenarioState": {
"type": "string",
"description": "The new state for the scenario to be updated to after this stub is served."
},
"postServeActions": {
"type": "object",
"description": "A map of the names of post serve action extensions to trigger and their parameters."
},
"metadata": {
"type": "object",
"description": "Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs."
}
},
"additionalProperties": false
},
"example": {
"request": {
"method": "GET",
"url": "/some/thing"
},
"response": {
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
},
"status": 200
}
}
}
}
},
"responses": {
"201": {
"description": "The stub mapping",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This stub mapping's unique identifier"
},
"uuid": {
"type": "string",
"description": "Alias for the id"
},
"name": {
"type": "string",
"description": "The stub mapping's name"
},
"request": {
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
"response": {
"allOf": [
{
"type": "object",
"properties": {
"status": {
"type": "integer",
"description": "The HTTP status code to be returned"
},
"statusMessage": {
"type": "string",
"description": "The HTTP status message to be returned"
},
"headers": {
"type": "object",
"description": "Map of response headers to send"
},
"additionalProxyRequestHeaders": {
"type": "object",
"description": "Extra request headers to send when proxying to another host."
},
"body": {
"type": "string",
"description": "The response body as a string. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"base64Body": {
"type": "string",
"description": "The response body as a base64 encoded string (useful for binary content). Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"jsonBody": {
"type": "object",
"description": "The response body as a JSON object. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"bodyFileName": {
"type": "string",
"description": "The path to the file containing the response body, relative to the configured file root. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"fault": {
"type": "string",
"description": "The fault to apply (instead of a full, valid response).",
"enum": [
"CONNECTION_RESET_BY_PEER",
"EMPTY_RESPONSE",
"MALFORMED_RESPONSE_CHUNK",
"RANDOM_DATA_THEN_CLOSE"
]
},
"fixedDelayMilliseconds": {
"type": "integer",
"description": "Number of milliseconds to delay be before sending the response."
},
"delayDistribution": {
"description": "The delay distribution. Valid property configuration is either median/sigma/type or lower/type/upper.",
"oneOf": [
{
"title": "Log normal",
"description": "Log normal randomly distributed response delay.",
"type": "object",
"properties": {
"median": {
"type": "integer"
},
"sigma": {
"type": "number"
},
"type": {
"enum": [
"lognormal"
],
"type": "string"
}
}
},
{
"title": "Uniform",
"description": "Uniformly distributed random response delay.",
"type": "object",
"properties": {
"lower": {
"type": "integer"
},
"type": {
"enum": [
"uniform"
],
"type": "string"
},
"upper": {
"type": "integer"
}
}
}
]
},
"fromConfiguredStub": {
"type": "boolean",
"description": "Read-only flag indicating false if this was the default, unmatched response. Not present otherwise."
},
"proxyBaseUrl": {
"type": "string",
"description": "The base URL of the target to proxy matching requests to."
},
"transformerParameters": {
"type": "object",
"description": "Parameters to apply to response transformers."
},
"transformers": {
"type": "array",
"description": "List of names of transformers to apply to this response.",
"items": {
"type": "string"
}
}
}
}
]
},
"persistent": {
"type": "boolean",
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default."
},
"priority": {
"type": "integer",
"description": "This stub mapping's priority relative to others. 1 is highest.",
"minimum": 1
},
"scenarioName": {
"type": "string",
"description": "The name of the scenario that this stub mapping is part of"
},
"requiredScenarioState": {
"type": "string",
"description": "The required state of the scenario in order for this stub to be matched."
},
"newScenarioState": {
"type": "string",
"description": "The new state for the scenario to be updated to after this stub is served."
},
"postServeActions": {
"type": "object",
"description": "A map of the names of post serve action extensions to trigger and their parameters."
},
"metadata": {
"type": "object",
"description": "Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs."
}
},
"additionalProperties": false
},
"example": {
"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
}
}
}
}
}
}
},
"delete": {
"summary": "Delete all stub mappings",
"tags": [
"Stub Mappings"
],
"responses": {
"200": {
"description": "Successfully deleted"
}
}
}
},
"/__admin/mappings/reset": {
"post": {
"summary": "Reset stub mappings",
"description": "Restores stub mappings to the defaults defined back in the backing store",
"tags": [
"Stub Mappings"
],
"responses": {
"200": {
"description": "Successfully reset"
}
}
}
},
"/__admin/mappings/save": {
"post": {
"summary": "Persist stub mappings",
"description": "Save all persistent stub mappings to the backing store",
"tags": [
"Stub Mappings"
],
"responses": {
"200": {
"description": "Successfully saved"
}
}
}
},
"/__admin/mappings/import": {
"post": {
"summary": "Import stub mappings",
"description": "Import given stub mappings to the backing store",
"tags": [
"Stub Mappings"
],
"responses": {
"200": {
"description": "Successfully imported"
}
}
}
},
"/__admin/mappings/{stubMappingId}": {
"parameters": [
{
"description": "The UUID of stub mapping",
"in": "path",
"name": "stubMappingId",
"required": true,
"example": "730d3e32-d098-4169-a20c-554c3bedce58",
"schema": {
"type": "string"
}
}
],
"get": {
"summary": "Get stub mapping by ID",
"tags": [
"Stub Mappings"
],
"responses": {
"200": {
"description": "The stub mapping",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This stub mapping's unique identifier"
},
"uuid": {
"type": "string",
"description": "Alias for the id"
},
"name": {
"type": "string",
"description": "The stub mapping's name"
},
"request": {
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
"response": {
"allOf": [
{
"type": "object",
"properties": {
"status": {
"type": "integer",
"description": "The HTTP status code to be returned"
},
"statusMessage": {
"type": "string",
"description": "The HTTP status message to be returned"
},
"headers": {
"type": "object",
"description": "Map of response headers to send"
},
"additionalProxyRequestHeaders": {
"type": "object",
"description": "Extra request headers to send when proxying to another host."
},
"body": {
"type": "string",
"description": "The response body as a string. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"base64Body": {
"type": "string",
"description": "The response body as a base64 encoded string (useful for binary content). Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"jsonBody": {
"type": "object",
"description": "The response body as a JSON object. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"bodyFileName": {
"type": "string",
"description": "The path to the file containing the response body, relative to the configured file root. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"fault": {
"type": "string",
"description": "The fault to apply (instead of a full, valid response).",
"enum": [
"CONNECTION_RESET_BY_PEER",
"EMPTY_RESPONSE",
"MALFORMED_RESPONSE_CHUNK",
"RANDOM_DATA_THEN_CLOSE"
]
},
"fixedDelayMilliseconds": {
"type": "integer",
"description": "Number of milliseconds to delay be before sending the response."
},
"delayDistribution": {
"description": "The delay distribution. Valid property configuration is either median/sigma/type or lower/type/upper.",
"oneOf": [
{
"title": "Log normal",
"description": "Log normal randomly distributed response delay.",
"type": "object",
"properties": {
"median": {
"type": "integer"
},
"sigma": {
"type": "number"
},
"type": {
"enum": [
"lognormal"
],
"type": "string"
}
}
},
{
"title": "Uniform",
"description": "Uniformly distributed random response delay.",
"type": "object",
"properties": {
"lower": {
"type": "integer"
},
"type": {
"enum": [
"uniform"
],
"type": "string"
},
"upper": {
"type": "integer"
}
}
}
]
},
"fromConfiguredStub": {
"type": "boolean",
"description": "Read-only flag indicating false if this was the default, unmatched response. Not present otherwise."
},
"proxyBaseUrl": {
"type": "string",
"description": "The base URL of the target to proxy matching requests to."
},
"transformerParameters": {
"type": "object",
"description": "Parameters to apply to response transformers."
},
"transformers": {
"type": "array",
"description": "List of names of transformers to apply to this response.",
"items": {
"type": "string"
}
}
}
}
]
},
"persistent": {
"type": "boolean",
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default."
},
"priority": {
"type": "integer",
"description": "This stub mapping's priority relative to others. 1 is highest.",
"minimum": 1
},
"scenarioName": {
"type": "string",
"description": "The name of the scenario that this stub mapping is part of"
},
"requiredScenarioState": {
"type": "string",
"description": "The required state of the scenario in order for this stub to be matched."
},
"newScenarioState": {
"type": "string",
"description": "The new state for the scenario to be updated to after this stub is served."
},
"postServeActions": {
"type": "object",
"description": "A map of the names of post serve action extensions to trigger and their parameters."
},
"metadata": {
"type": "object",
"description": "Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs."
}
},
"additionalProperties": false
},
"example": {
"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
}
}
}
}
},
"404": {
"description": "Stub mapping not found"
}
}
},
"put": {
"summary": "Update a stub mapping",
"tags": [
"Stub Mappings"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This stub mapping's unique identifier"
},
"uuid": {
"type": "string",
"description": "Alias for the id"
},
"name": {
"type": "string",
"description": "The stub mapping's name"
},
"request": {
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
"response": {
"allOf": [
{
"type": "object",
"properties": {
"status": {
"type": "integer",
"description": "The HTTP status code to be returned"
},
"statusMessage": {
"type": "string",
"description": "The HTTP status message to be returned"
},
"headers": {
"type": "object",
"description": "Map of response headers to send"
},
"additionalProxyRequestHeaders": {
"type": "object",
"description": "Extra request headers to send when proxying to another host."
},
"body": {
"type": "string",
"description": "The response body as a string. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"base64Body": {
"type": "string",
"description": "The response body as a base64 encoded string (useful for binary content). Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"jsonBody": {
"type": "object",
"description": "The response body as a JSON object. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"bodyFileName": {
"type": "string",
"description": "The path to the file containing the response body, relative to the configured file root. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"fault": {
"type": "string",
"description": "The fault to apply (instead of a full, valid response).",
"enum": [
"CONNECTION_RESET_BY_PEER",
"EMPTY_RESPONSE",
"MALFORMED_RESPONSE_CHUNK",
"RANDOM_DATA_THEN_CLOSE"
]
},
"fixedDelayMilliseconds": {
"type": "integer",
"description": "Number of milliseconds to delay be before sending the response."
},
"delayDistribution": {
"description": "The delay distribution. Valid property configuration is either median/sigma/type or lower/type/upper.",
"oneOf": [
{
"title": "Log normal",
"description": "Log normal randomly distributed response delay.",
"type": "object",
"properties": {
"median": {
"type": "integer"
},
"sigma": {
"type": "number"
},
"type": {
"enum": [
"lognormal"
],
"type": "string"
}
}
},
{
"title": "Uniform",
"description": "Uniformly distributed random response delay.",
"type": "object",
"properties": {
"lower": {
"type": "integer"
},
"type": {
"enum": [
"uniform"
],
"type": "string"
},
"upper": {
"type": "integer"
}
}
}
]
},
"fromConfiguredStub": {
"type": "boolean",
"description": "Read-only flag indicating false if this was the default, unmatched response. Not present otherwise."
},
"proxyBaseUrl": {
"type": "string",
"description": "The base URL of the target to proxy matching requests to."
},
"transformerParameters": {
"type": "object",
"description": "Parameters to apply to response transformers."
},
"transformers": {
"type": "array",
"description": "List of names of transformers to apply to this response.",
"items": {
"type": "string"
}
}
}
}
]
},
"persistent": {
"type": "boolean",
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default."
},
"priority": {
"type": "integer",
"description": "This stub mapping's priority relative to others. 1 is highest.",
"minimum": 1
},
"scenarioName": {
"type": "string",
"description": "The name of the scenario that this stub mapping is part of"
},
"requiredScenarioState": {
"type": "string",
"description": "The required state of the scenario in order for this stub to be matched."
},
"newScenarioState": {
"type": "string",
"description": "The new state for the scenario to be updated to after this stub is served."
},
"postServeActions": {
"type": "object",
"description": "A map of the names of post serve action extensions to trigger and their parameters."
},
"metadata": {
"type": "object",
"description": "Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs."
}
},
"additionalProperties": false
},
"example": {
"request": {
"method": "GET",
"url": "/some/thing"
},
"response": {
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
},
"status": 200
}
}
}
}
},
"responses": {
"200": {
"description": "The stub mapping",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This stub mapping's unique identifier"
},
"uuid": {
"type": "string",
"description": "Alias for the id"
},
"name": {
"type": "string",
"description": "The stub mapping's name"
},
"request": {
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
"response": {
"allOf": [
{
"type": "object",
"properties": {
"status": {
"type": "integer",
"description": "The HTTP status code to be returned"
},
"statusMessage": {
"type": "string",
"description": "The HTTP status message to be returned"
},
"headers": {
"type": "object",
"description": "Map of response headers to send"
},
"additionalProxyRequestHeaders": {
"type": "object",
"description": "Extra request headers to send when proxying to another host."
},
"body": {
"type": "string",
"description": "The response body as a string. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"base64Body": {
"type": "string",
"description": "The response body as a base64 encoded string (useful for binary content). Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"jsonBody": {
"type": "object",
"description": "The response body as a JSON object. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"bodyFileName": {
"type": "string",
"description": "The path to the file containing the response body, relative to the configured file root. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"fault": {
"type": "string",
"description": "The fault to apply (instead of a full, valid response).",
"enum": [
"CONNECTION_RESET_BY_PEER",
"EMPTY_RESPONSE",
"MALFORMED_RESPONSE_CHUNK",
"RANDOM_DATA_THEN_CLOSE"
]
},
"fixedDelayMilliseconds": {
"type": "integer",
"description": "Number of milliseconds to delay be before sending the response."
},
"delayDistribution": {
"description": "The delay distribution. Valid property configuration is either median/sigma/type or lower/type/upper.",
"oneOf": [
{
"title": "Log normal",
"description": "Log normal randomly distributed response delay.",
"type": "object",
"properties": {
"median": {
"type": "integer"
},
"sigma": {
"type": "number"
},
"type": {
"enum": [
"lognormal"
],
"type": "string"
}
}
},
{
"title": "Uniform",
"description": "Uniformly distributed random response delay.",
"type": "object",
"properties": {
"lower": {
"type": "integer"
},
"type": {
"enum": [
"uniform"
],
"type": "string"
},
"upper": {
"type": "integer"
}
}
}
]
},
"fromConfiguredStub": {
"type": "boolean",
"description": "Read-only flag indicating false if this was the default, unmatched response. Not present otherwise."
},
"proxyBaseUrl": {
"type": "string",
"description": "The base URL of the target to proxy matching requests to."
},
"transformerParameters": {
"type": "object",
"description": "Parameters to apply to response transformers."
},
"transformers": {
"type": "array",
"description": "List of names of transformers to apply to this response.",
"items": {
"type": "string"
}
}
}
}
]
},
"persistent": {
"type": "boolean",
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default."
},
"priority": {
"type": "integer",
"description": "This stub mapping's priority relative to others. 1 is highest.",
"minimum": 1
},
"scenarioName": {
"type": "string",
"description": "The name of the scenario that this stub mapping is part of"
},
"requiredScenarioState": {
"type": "string",
"description": "The required state of the scenario in order for this stub to be matched."
},
"newScenarioState": {
"type": "string",
"description": "The new state for the scenario to be updated to after this stub is served."
},
"postServeActions": {
"type": "object",
"description": "A map of the names of post serve action extensions to trigger and their parameters."
},
"metadata": {
"type": "object",
"description": "Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs."
}
},
"additionalProperties": false
},
"example": {
"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
}
}
}
}
},
"404": {
"description": "Stub mapping not found"
}
}
},
"delete": {
"summary": "Delete a stub mapping",
"tags": [
"Stub Mappings"
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Stub mapping not found"
}
}
}
},
"/__admin/mappings/find-by-metadata": {
"post": {
"description": "Find stubs by matching on their metadata",
"tags": [
"Stub Mappings"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"title": "String equals",
"type": "object",
"properties": {
"equalTo": {
"type": "boolean"
},
"caseInsensitive": {
"type": "boolean"
}
},
"required": [
"equalTo"
]
},
{
"title": "String contains",
"type": "object",
"properties": {
"contains": {
"type": "string"
}
},
"required": [
"contains"
]
},
{
"title": "Regular expression match",
"type": "object",
"properties": {
"matches": {
"type": "string"
}
},
"required": [
"matches"
]
},
{
"title": "Negative regular expression match",
"type": "object",
"properties": {
"doesNotMatch": {
"type": "string"
}
},
"required": [
"doesNotMatch"
]
},
{
"title": "JSON equals",
"type": "object",
"properties": {
"equalToJson": {
"type": "string"
}
},
"required": [
"equalToJson"
]
},
{
"title": "JSONPath match",
"type": "object",
"properties": {
"matchesJsonPath": {
"type": "string"
},
"ignoreArrayOrder": {
"type": "boolean"
},
"ignoreExtraElements": {
"type": "boolean"
}
},
"required": [
"matchesJsonPath"
]
},
{
"title": "XML equality",
"type": "object",
"properties": {
"equalToXml": {
"type": "string"
}
},
"required": [
"equalToXml"
]
},
{
"title": "XPath match",
"type": "object",
"properties": {
"matchesXpath": {
"type": "string"
},
"namespaces": {
"type": "object"
},
"valuePattern": {
"type": "object"
}
},
"required": [
"matchesXpath"
]
}
]
},
"example": {
"matchesJsonPath": {
"expression": "$.outer",
"equalToJson": "{ \"inner\": 42 }"
}
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"mappings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This stub mapping's unique identifier"
},
"uuid": {
"type": "string",
"description": "Alias for the id"
},
"name": {
"type": "string",
"description": "The stub mapping's name"
},
"request": {
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
"response": {
"allOf": [
{
"type": "object",
"properties": {
"status": {
"type": "integer",
"description": "The HTTP status code to be returned"
},
"statusMessage": {
"type": "string",
"description": "The HTTP status message to be returned"
},
"headers": {
"type": "object",
"description": "Map of response headers to send"
},
"additionalProxyRequestHeaders": {
"type": "object",
"description": "Extra request headers to send when proxying to another host."
},
"body": {
"type": "string",
"description": "The response body as a string. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"base64Body": {
"type": "string",
"description": "The response body as a base64 encoded string (useful for binary content). Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"jsonBody": {
"type": "object",
"description": "The response body as a JSON object. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"bodyFileName": {
"type": "string",
"description": "The path to the file containing the response body, relative to the configured file root. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"fault": {
"type": "string",
"description": "The fault to apply (instead of a full, valid response).",
"enum": [
"CONNECTION_RESET_BY_PEER",
"EMPTY_RESPONSE",
"MALFORMED_RESPONSE_CHUNK",
"RANDOM_DATA_THEN_CLOSE"
]
},
"fixedDelayMilliseconds": {
"type": "integer",
"description": "Number of milliseconds to delay be before sending the response."
},
"delayDistribution": {
"description": "The delay distribution. Valid property configuration is either median/sigma/type or lower/type/upper.",
"oneOf": [
{
"title": "Log normal",
"description": "Log normal randomly distributed response delay.",
"type": "object",
"properties": {
"median": {
"type": "integer"
},
"sigma": {
"type": "number"
},
"type": {
"enum": [
"lognormal"
],
"type": "string"
}
}
},
{
"title": "Uniform",
"description": "Uniformly distributed random response delay.",
"type": "object",
"properties": {
"lower": {
"type": "integer"
},
"type": {
"enum": [
"uniform"
],
"type": "string"
},
"upper": {
"type": "integer"
}
}
}
]
},
"fromConfiguredStub": {
"type": "boolean",
"description": "Read-only flag indicating false if this was the default, unmatched response. Not present otherwise."
},
"proxyBaseUrl": {
"type": "string",
"description": "The base URL of the target to proxy matching requests to."
},
"transformerParameters": {
"type": "object",
"description": "Parameters to apply to response transformers."
},
"transformers": {
"type": "array",
"description": "List of names of transformers to apply to this response.",
"items": {
"type": "string"
}
}
}
}
]
},
"persistent": {
"type": "boolean",
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default."
},
"priority": {
"type": "integer",
"description": "This stub mapping's priority relative to others. 1 is highest.",
"minimum": 1
},
"scenarioName": {
"type": "string",
"description": "The name of the scenario that this stub mapping is part of"
},
"requiredScenarioState": {
"type": "string",
"description": "The required state of the scenario in order for this stub to be matched."
},
"newScenarioState": {
"type": "string",
"description": "The new state for the scenario to be updated to after this stub is served."
},
"postServeActions": {
"type": "object",
"description": "A map of the names of post serve action extensions to trigger and their parameters."
},
"metadata": {
"type": "object",
"description": "Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs."
}
},
"additionalProperties": false
}
},
"meta": {
"type": "object",
"properties": {
"total": {
"type": "integer",
"example": 4
}
},
"required": [
"total"
]
}
},
"additionalProperties": false
},
"example": {
"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": " "
}
]
},
"response": {
"status": 201
}
}
]
}
}
},
"description": "Matched stub mappings"
}
}
}
},
"/__admin/mappings/remove-by-metadata": {
"post": {
"summary": "Delete stub mappings matching metadata",
"tags": [
"Stub Mappings"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"title": "String equals",
"type": "object",
"properties": {
"equalTo": {
"type": "boolean"
},
"caseInsensitive": {
"type": "boolean"
}
},
"required": [
"equalTo"
]
},
{
"title": "String contains",
"type": "object",
"properties": {
"contains": {
"type": "string"
}
},
"required": [
"contains"
]
},
{
"title": "Regular expression match",
"type": "object",
"properties": {
"matches": {
"type": "string"
}
},
"required": [
"matches"
]
},
{
"title": "Negative regular expression match",
"type": "object",
"properties": {
"doesNotMatch": {
"type": "string"
}
},
"required": [
"doesNotMatch"
]
},
{
"title": "JSON equals",
"type": "object",
"properties": {
"equalToJson": {
"type": "string"
}
},
"required": [
"equalToJson"
]
},
{
"title": "JSONPath match",
"type": "object",
"properties": {
"matchesJsonPath": {
"type": "string"
},
"ignoreArrayOrder": {
"type": "boolean"
},
"ignoreExtraElements": {
"type": "boolean"
}
},
"required": [
"matchesJsonPath"
]
},
{
"title": "XML equality",
"type": "object",
"properties": {
"equalToXml": {
"type": "string"
}
},
"required": [
"equalToXml"
]
},
{
"title": "XPath match",
"type": "object",
"properties": {
"matchesXpath": {
"type": "string"
},
"namespaces": {
"type": "object"
},
"valuePattern": {
"type": "object"
}
},
"required": [
"matchesXpath"
]
}
]
},
"example": {
"matchesJsonPath": {
"expression": "$.outer",
"equalToJson": "{ \"inner\": 42 }"
}
}
}
}
},
"responses": {
"200": {
"description": "The stub mappings were successfully removed"
}
}
}
},
"/__admin/requests": {
"get": {
"summary": "Get all requests in journal",
"tags": [
"Requests"
],
"parameters": [
{
"description": "The maximum number of results to return",
"in": "query",
"name": "limit",
"example": 10,
"schema": {
"type": "string"
}
},
{
"description": "Only return logged requests after this date",
"in": "query",
"name": "since",
"example": "2016-10-05T12:33:01.000Z",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"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
}
}
},
"description": "List of received requests"
}
}
},
"delete": {
"summary": "Delete all requests in journal",
"tags": [
"Requests"
],
"responses": {
"200": {
"description": "Successfully deleted"
}
}
}
},
"/__admin/requests/{requestId}": {
"get": {
"summary": "Get request by ID",
"tags": [
"Requests"
],
"parameters": [
{
"description": "The UUID of the logged request",
"in": "path",
"name": "requestId",
"required": true,
"example": "12fb14bb-600e-4bfa-bd8d-be7f12562c99",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"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": {}
}
}
}
}
},
"404": {
"description": "Request not found"
}
}
},
"delete": {
"summary": "Delete request by ID",
"tags": [
"Requests"
],
"parameters": [
{
"description": "The UUID of the logged request",
"in": "path",
"name": "requestId",
"required": true,
"example": "12fb14bb-600e-4bfa-bd8d-be7f12562c99",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successfully deleted"
}
}
}
},
"/__admin/requests/reset": {
"post": {
"deprecated": true,
"summary": "Empty the request journal",
"tags": [
"Requests"
],
"responses": {
"200": {
"description": "Successfully reset"
}
}
}
},
"/__admin/requests/count": {
"post": {
"summary": "Count requests by criteria",
"description": "Count requests logged in the journal matching the specified criteria",
"tags": [
"Requests"
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
"example": {
"method": "POST",
"url": "/resource",
"headers": {
"Content-Type": {
"matches": ".*/xml"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Number of matching requests",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"count": {
"type": "integer",
"example": 4
}
}
}
}
}
}
}
}
},
"/__admin/requests/remove": {
"post": {
"summary": "Remove requests by criteria",
"description": "Removed requests logged in the journal matching the specified criteria",
"tags": [
"Requests"
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
"example": {
"method": "POST",
"url": "/resource",
"headers": {
"Content-Type": {
"matches": ".*/xml"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Removed request details",
"content": {
"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"
}
]
}
}
}
}
}
}
},
"/__admin/requests/remove-by-metadata": {
"post": {
"summary": "Delete requests mappings matching metadata",
"tags": [
"Requests"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"title": "String equals",
"type": "object",
"properties": {
"equalTo": {
"type": "boolean"
},
"caseInsensitive": {
"type": "boolean"
}
},
"required": [
"equalTo"
]
},
{
"title": "String contains",
"type": "object",
"properties": {
"contains": {
"type": "string"
}
},
"required": [
"contains"
]
},
{
"title": "Regular expression match",
"type": "object",
"properties": {
"matches": {
"type": "string"
}
},
"required": [
"matches"
]
},
{
"title": "Negative regular expression match",
"type": "object",
"properties": {
"doesNotMatch": {
"type": "string"
}
},
"required": [
"doesNotMatch"
]
},
{
"title": "JSON equals",
"type": "object",
"properties": {
"equalToJson": {
"type": "string"
}
},
"required": [
"equalToJson"
]
},
{
"title": "JSONPath match",
"type": "object",
"properties": {
"matchesJsonPath": {
"type": "string"
},
"ignoreArrayOrder": {
"type": "boolean"
},
"ignoreExtraElements": {
"type": "boolean"
}
},
"required": [
"matchesJsonPath"
]
},
{
"title": "XML equality",
"type": "object",
"properties": {
"equalToXml": {
"type": "string"
}
},
"required": [
"equalToXml"
]
},
{
"title": "XPath match",
"type": "object",
"properties": {
"matchesXpath": {
"type": "string"
},
"namespaces": {
"type": "object"
},
"valuePattern": {
"type": "object"
}
},
"required": [
"matchesXpath"
]
}
]
},
"example": {
"matchesJsonPath": {
"expression": "$.outer",
"equalToJson": "{ \"inner\": 42 }"
}
}
}
}
},
"responses": {
"200": {
"description": "Removed request details",
"content": {
"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"
}
]
}
}
}
}
}
}
},
"/__admin/requests/find": {
"post": {
"summary": "Find requests by criteria",
"description": "Retrieve details of requests logged in the journal matching the specified criteria",
"tags": [
"Requests"
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
"example": {
"method": "POST",
"url": "/resource",
"headers": {
"Content-Type": {
"matches": ".*/xml"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Matching request details",
"content": {
"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"
}
]
}
}
}
}
}
}
},
"/__admin/requests/unmatched": {
"get": {
"summary": "Find unmatched requests",
"description": "Get details of logged requests that weren't matched by any stub mapping",
"tags": [
"Requests"
],
"responses": {
"200": {
"description": "Unmatched request details",
"content": {
"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"
}
]
}
}
}
}
}
}
},
"/__admin/requests/unmatched/near-misses": {
"get": {
"description": "Retrieve near-misses for all unmatched requests",
"tags": [
"Near Misses"
],
"responses": {
"200": {
"description": "Near misses matching criteria",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"nearMisses": {
"type": "array",
"items": {
"type": "object",
"properties": {
"method": {
"description": "The HTTP request method",
"type": "string",
"example": "GET"
},
"url": {
"description": "The path and query to match exactly against",
"type": "string",
"example": "/received-request/2"
},
"absoluteUrl": {
"description": "The full URL to match against",
"type": "string",
"example": "http://localhost:56738/received-request/2"
},
"headers": {
"description": "Header patterns to match against in the : { \"\": \"\" } form",
"type": "object",
"example": {
"Connection": "keep-alive",
"Host": "localhost:56738",
"User-Agent": "Apache-HttpClient/4.5.1 (Java/1.7.0_51)"
}
},
"cookies": {
"description": "Cookie patterns to match against in the : { \"\": \"\" } form",
"type": "object",
"example": {}
},
"body": {
"description": "Body string to match against",
"type": "string",
"example": "Hello world"
}
}
}
}
}
},
"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/near-misses/request": {
"post": {
"summary": "Find near misses matching specific request",
"description": "Find at most 3 near misses for closest stub mappings to the specified request",
"tags": [
"Near Misses"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"method": {
"description": "The HTTP request method",
"type": "string",
"example": "GET"
},
"url": {
"description": "The path and query to match exactly against",
"type": "string",
"example": "/received-request/2"
},
"absoluteUrl": {
"description": "The full URL to match against",
"type": "string",
"example": "http://localhost:56738/received-request/2"
},
"headers": {
"description": "Header patterns to match against in the : { \"\": \"\" } form",
"type": "object",
"example": {
"Connection": "keep-alive",
"Host": "localhost:56738",
"User-Agent": "Apache-HttpClient/4.5.1 (Java/1.7.0_51)"
}
},
"cookies": {
"description": "Cookie patterns to match against in the : { \"\": \"\" } form",
"type": "object",
"example": {}
},
"body": {
"description": "Body string to match against",
"type": "string",
"example": "Hello world"
}
}
},
"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"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Near misses matching criteria",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"nearMisses": {
"type": "array",
"items": {
"type": "object",
"properties": {
"method": {
"description": "The HTTP request method",
"type": "string",
"example": "GET"
},
"url": {
"description": "The path and query to match exactly against",
"type": "string",
"example": "/received-request/2"
},
"absoluteUrl": {
"description": "The full URL to match against",
"type": "string",
"example": "http://localhost:56738/received-request/2"
},
"headers": {
"description": "Header patterns to match against in the : { \"\": \"\" } form",
"type": "object",
"example": {
"Connection": "keep-alive",
"Host": "localhost:56738",
"User-Agent": "Apache-HttpClient/4.5.1 (Java/1.7.0_51)"
}
},
"cookies": {
"description": "Cookie patterns to match against in the : { \"\": \"\" } form",
"type": "object",
"example": {}
},
"body": {
"description": "Body string to match against",
"type": "string",
"example": "Hello world"
}
}
}
}
}
},
"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/near-misses/request-pattern": {
"post": {
"summary": "Find near misses matching request pattern",
"description": "Find at most 3 near misses for closest logged requests to the specified request pattern",
"tags": [
"Near Misses"
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
"example": {
"method": "POST",
"url": "/resource",
"headers": {
"Content-Type": {
"matches": ".*/xml"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Near misses matching criteria",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"nearMisses": {
"type": "array",
"items": {
"type": "object",
"properties": {
"method": {
"description": "The HTTP request method",
"type": "string",
"example": "GET"
},
"url": {
"description": "The path and query to match exactly against",
"type": "string",
"example": "/received-request/2"
},
"absoluteUrl": {
"description": "The full URL to match against",
"type": "string",
"example": "http://localhost:56738/received-request/2"
},
"headers": {
"description": "Header patterns to match against in the : { \"\": \"\" } form",
"type": "object",
"example": {
"Connection": "keep-alive",
"Host": "localhost:56738",
"User-Agent": "Apache-HttpClient/4.5.1 (Java/1.7.0_51)"
}
},
"cookies": {
"description": "Cookie patterns to match against in the : { \"\": \"\" } form",
"type": "object",
"example": {}
},
"body": {
"description": "Body string to match against",
"type": "string",
"example": "Hello world"
}
}
}
}
}
},
"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/start": {
"post": {
"summary": "Start recording",
"description": "Begin recording stub mappings",
"tags": [
"Recordings"
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"allOf": [
{
"type": "object",
"properties": {
"captureHeaders": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"caseInsensitive": {
"type": "boolean"
}
}
},
"description": "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",
"example": {
"Accept": {},
"Content-Type": {
"caseInsensitive": true
}
}
},
"extractBodyCriteria": {
"type": "object",
"description": "Criteria for extracting response bodies to a separate file instead of including it in the stub mapping",
"example": [
{
"binarySizeThreshold": "1 Mb",
"textSizeThreshold": "2 kb"
}
],
"properties": {
"binarySizeThreshold": {
"type": "string",
"default": "0",
"description": "Size threshold for extracting binary response bodies. Supports humanized size strings, e.g. \"56 Mb\". Default unit is bytes.",
"example": "18.2 GB"
},
"textSizeThreshold": {
"default": "0",
"description": "Size threshold for extracting binary response bodies. Supports humanized size strings, e.g. \"56 Mb\". Default unit is bytes.",
"example": "18.2 GB",
"type": "string"
}
}
},
"persist": {
"type": "boolean",
"default": true,
"description": "Whether to save stub mappings to the file system or just return them"
},
"repeatsAsScenarios": {
"type": "boolean",
"default": true,
"description": "When true, duplicate requests will be added to a Scenario. When false, duplicates are discarded"
},
"requestBodyPattern": {
"type": "object",
"description": "Control the request body matcher used in generated stub mappings",
"oneOf": [
{
"type": "object",
"description": "Automatically determine matcher based on content type (the default)",
"properties": {
"caseInsensitive": {
"type": "boolean",
"default": false,
"description": "If equalTo is used, match body use case-insensitive string comparison"
},
"ignoreArrayOrder": {
"type": "boolean",
"default": true,
"description": "If equalToJson is used, ignore order of array elements"
},
"ignoreExtraElements": {
"type": "boolean",
"default": true,
"description": "If equalToJson is used, matcher ignores extra elements in objects"
},
"matcher": {
"type": "string",
"enum": [
"auto"
]
}
}
},
{
"type": "object",
"description": "Always match request bodies using equalTo",
"properties": {
"caseInsensitive": {
"default": false,
"description": "Match body using case-insensitive string comparison",
"type": "boolean"
},
"matcher": {
"enum": [
"equalTo"
],
"type": "string"
}
}
},
{
"type": "object",
"description": "Always match request bodies using equalToJson",
"properties": {
"ignoreArrayOrder": {
"default": true,
"description": "Ignore order of array elements",
"type": "boolean"
},
"ignoreExtraElements": {
"default": true,
"description": "Ignore extra elements in objects",
"type": "boolean"
},
"matcher": {
"enum": [
"equalToJson"
],
"type": "string"
}
}
},
{
"type": "object",
"description": "Always match request bodies using equalToXml",
"properties": {
"matcher": {
"type": "string",
"enum": [
"equalToXml"
]
}
}
}
]
},
"transformerParameters": {
"type": "object",
"description": "List of names of stub mappings transformers to apply to generated stubs"
},
"transformers": {
"type": "array",
"description": "Parameters to pass to stub mapping transformers",
"items": {
"type": "string"
}
}
}
},
{
"properties": {
"filters": {
"allOf": [
{
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
{
"description": "Filter requests for which to create stub mapping"
}
]
},
"targetBaseUrl": {
"type": "string",
"description": "Target URL when using the record and playback API",
"example": "http://example.mocklab.io"
}
}
}
]
},
"example": {
"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"
}
}
}
}
},
"responses": {
"200": {
"description": "Successfully started recording"
}
}
}
},
"/__admin/recordings/stop": {
"post": {
"summary": "Stop recording",
"description": "End recording of stub mappings",
"tags": [
"Recordings"
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"mappings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This stub mapping's unique identifier"
},
"uuid": {
"type": "string",
"description": "Alias for the id"
},
"name": {
"type": "string",
"description": "The stub mapping's name"
},
"request": {
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
"response": {
"allOf": [
{
"type": "object",
"properties": {
"status": {
"type": "integer",
"description": "The HTTP status code to be returned"
},
"statusMessage": {
"type": "string",
"description": "The HTTP status message to be returned"
},
"headers": {
"type": "object",
"description": "Map of response headers to send"
},
"additionalProxyRequestHeaders": {
"type": "object",
"description": "Extra request headers to send when proxying to another host."
},
"body": {
"type": "string",
"description": "The response body as a string. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"base64Body": {
"type": "string",
"description": "The response body as a base64 encoded string (useful for binary content). Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"jsonBody": {
"type": "object",
"description": "The response body as a JSON object. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"bodyFileName": {
"type": "string",
"description": "The path to the file containing the response body, relative to the configured file root. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"fault": {
"type": "string",
"description": "The fault to apply (instead of a full, valid response).",
"enum": [
"CONNECTION_RESET_BY_PEER",
"EMPTY_RESPONSE",
"MALFORMED_RESPONSE_CHUNK",
"RANDOM_DATA_THEN_CLOSE"
]
},
"fixedDelayMilliseconds": {
"type": "integer",
"description": "Number of milliseconds to delay be before sending the response."
},
"delayDistribution": {
"description": "The delay distribution. Valid property configuration is either median/sigma/type or lower/type/upper.",
"oneOf": [
{
"title": "Log normal",
"description": "Log normal randomly distributed response delay.",
"type": "object",
"properties": {
"median": {
"type": "integer"
},
"sigma": {
"type": "number"
},
"type": {
"enum": [
"lognormal"
],
"type": "string"
}
}
},
{
"title": "Uniform",
"description": "Uniformly distributed random response delay.",
"type": "object",
"properties": {
"lower": {
"type": "integer"
},
"type": {
"enum": [
"uniform"
],
"type": "string"
},
"upper": {
"type": "integer"
}
}
}
]
},
"fromConfiguredStub": {
"type": "boolean",
"description": "Read-only flag indicating false if this was the default, unmatched response. Not present otherwise."
},
"proxyBaseUrl": {
"type": "string",
"description": "The base URL of the target to proxy matching requests to."
},
"transformerParameters": {
"type": "object",
"description": "Parameters to apply to response transformers."
},
"transformers": {
"type": "array",
"description": "List of names of transformers to apply to this response.",
"items": {
"type": "string"
}
}
}
}
]
},
"persistent": {
"type": "boolean",
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default."
},
"priority": {
"type": "integer",
"description": "This stub mapping's priority relative to others. 1 is highest.",
"minimum": 1
},
"scenarioName": {
"type": "string",
"description": "The name of the scenario that this stub mapping is part of"
},
"requiredScenarioState": {
"type": "string",
"description": "The required state of the scenario in order for this stub to be matched."
},
"newScenarioState": {
"type": "string",
"description": "The new state for the scenario to be updated to after this stub is served."
},
"postServeActions": {
"type": "object",
"description": "A map of the names of post serve action extensions to trigger and their parameters."
},
"metadata": {
"type": "object",
"description": "Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs."
}
},
"additionalProperties": false
}
},
"meta": {
"type": "object",
"properties": {
"total": {
"type": "integer",
"example": 4
}
},
"required": [
"total"
]
}
},
"additionalProperties": false
},
"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
}
]
}
}
},
"description": "Successfully stopped recording"
}
}
}
},
"/__admin/recordings/status": {
"get": {
"summary": "Get recording status",
"tags": [
"Recordings"
],
"responses": {
"200": {
"description": "Successfully got the record status",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "Stopped",
"enum": [
"NeverStarted",
"Recording",
"Stopped"
]
}
}
}
}
}
}
}
}
},
"/__admin/recordings/snapshot": {
"post": {
"summary": "Take a snapshot recording",
"tags": [
"Recordings"
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"allOf": [
{
"type": "object",
"properties": {
"captureHeaders": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"caseInsensitive": {
"type": "boolean"
}
}
},
"description": "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",
"example": {
"Accept": {},
"Content-Type": {
"caseInsensitive": true
}
}
},
"extractBodyCriteria": {
"type": "object",
"description": "Criteria for extracting response bodies to a separate file instead of including it in the stub mapping",
"example": [
{
"binarySizeThreshold": "1 Mb",
"textSizeThreshold": "2 kb"
}
],
"properties": {
"binarySizeThreshold": {
"type": "string",
"default": "0",
"description": "Size threshold for extracting binary response bodies. Supports humanized size strings, e.g. \"56 Mb\". Default unit is bytes.",
"example": "18.2 GB"
},
"textSizeThreshold": {
"default": "0",
"description": "Size threshold for extracting binary response bodies. Supports humanized size strings, e.g. \"56 Mb\". Default unit is bytes.",
"example": "18.2 GB",
"type": "string"
}
}
},
"persist": {
"type": "boolean",
"default": true,
"description": "Whether to save stub mappings to the file system or just return them"
},
"repeatsAsScenarios": {
"type": "boolean",
"default": true,
"description": "When true, duplicate requests will be added to a Scenario. When false, duplicates are discarded"
},
"requestBodyPattern": {
"type": "object",
"description": "Control the request body matcher used in generated stub mappings",
"oneOf": [
{
"type": "object",
"description": "Automatically determine matcher based on content type (the default)",
"properties": {
"caseInsensitive": {
"type": "boolean",
"default": false,
"description": "If equalTo is used, match body use case-insensitive string comparison"
},
"ignoreArrayOrder": {
"type": "boolean",
"default": true,
"description": "If equalToJson is used, ignore order of array elements"
},
"ignoreExtraElements": {
"type": "boolean",
"default": true,
"description": "If equalToJson is used, matcher ignores extra elements in objects"
},
"matcher": {
"type": "string",
"enum": [
"auto"
]
}
}
},
{
"type": "object",
"description": "Always match request bodies using equalTo",
"properties": {
"caseInsensitive": {
"default": false,
"description": "Match body using case-insensitive string comparison",
"type": "boolean"
},
"matcher": {
"enum": [
"equalTo"
],
"type": "string"
}
}
},
{
"type": "object",
"description": "Always match request bodies using equalToJson",
"properties": {
"ignoreArrayOrder": {
"default": true,
"description": "Ignore order of array elements",
"type": "boolean"
},
"ignoreExtraElements": {
"default": true,
"description": "Ignore extra elements in objects",
"type": "boolean"
},
"matcher": {
"enum": [
"equalToJson"
],
"type": "string"
}
}
},
{
"type": "object",
"description": "Always match request bodies using equalToXml",
"properties": {
"matcher": {
"type": "string",
"enum": [
"equalToXml"
]
}
}
}
]
},
"transformerParameters": {
"type": "object",
"description": "List of names of stub mappings transformers to apply to generated stubs"
},
"transformers": {
"type": "array",
"description": "Parameters to pass to stub mapping transformers",
"items": {
"type": "string"
}
}
}
},
{
"properties": {
"filters": {
"type": "object",
"allOf": [
{
"properties": {
"ids": {
"type": "array",
"items": {
"type": "string"
}
}
},
"type": "object",
"description": "Filter requests for which to create stub mapping"
},
{
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
}
]
}
}
}
]
},
"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"
}
}
}
}
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"mappings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This stub mapping's unique identifier"
},
"uuid": {
"type": "string",
"description": "Alias for the id"
},
"name": {
"type": "string",
"description": "The stub mapping's name"
},
"request": {
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
"response": {
"allOf": [
{
"type": "object",
"properties": {
"status": {
"type": "integer",
"description": "The HTTP status code to be returned"
},
"statusMessage": {
"type": "string",
"description": "The HTTP status message to be returned"
},
"headers": {
"type": "object",
"description": "Map of response headers to send"
},
"additionalProxyRequestHeaders": {
"type": "object",
"description": "Extra request headers to send when proxying to another host."
},
"body": {
"type": "string",
"description": "The response body as a string. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"base64Body": {
"type": "string",
"description": "The response body as a base64 encoded string (useful for binary content). Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"jsonBody": {
"type": "object",
"description": "The response body as a JSON object. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"bodyFileName": {
"type": "string",
"description": "The path to the file containing the response body, relative to the configured file root. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"fault": {
"type": "string",
"description": "The fault to apply (instead of a full, valid response).",
"enum": [
"CONNECTION_RESET_BY_PEER",
"EMPTY_RESPONSE",
"MALFORMED_RESPONSE_CHUNK",
"RANDOM_DATA_THEN_CLOSE"
]
},
"fixedDelayMilliseconds": {
"type": "integer",
"description": "Number of milliseconds to delay be before sending the response."
},
"delayDistribution": {
"description": "The delay distribution. Valid property configuration is either median/sigma/type or lower/type/upper.",
"oneOf": [
{
"title": "Log normal",
"description": "Log normal randomly distributed response delay.",
"type": "object",
"properties": {
"median": {
"type": "integer"
},
"sigma": {
"type": "number"
},
"type": {
"enum": [
"lognormal"
],
"type": "string"
}
}
},
{
"title": "Uniform",
"description": "Uniformly distributed random response delay.",
"type": "object",
"properties": {
"lower": {
"type": "integer"
},
"type": {
"enum": [
"uniform"
],
"type": "string"
},
"upper": {
"type": "integer"
}
}
}
]
},
"fromConfiguredStub": {
"type": "boolean",
"description": "Read-only flag indicating false if this was the default, unmatched response. Not present otherwise."
},
"proxyBaseUrl": {
"type": "string",
"description": "The base URL of the target to proxy matching requests to."
},
"transformerParameters": {
"type": "object",
"description": "Parameters to apply to response transformers."
},
"transformers": {
"type": "array",
"description": "List of names of transformers to apply to this response.",
"items": {
"type": "string"
}
}
}
}
]
},
"persistent": {
"type": "boolean",
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default."
},
"priority": {
"type": "integer",
"description": "This stub mapping's priority relative to others. 1 is highest.",
"minimum": 1
},
"scenarioName": {
"type": "string",
"description": "The name of the scenario that this stub mapping is part of"
},
"requiredScenarioState": {
"type": "string",
"description": "The required state of the scenario in order for this stub to be matched."
},
"newScenarioState": {
"type": "string",
"description": "The new state for the scenario to be updated to after this stub is served."
},
"postServeActions": {
"type": "object",
"description": "A map of the names of post serve action extensions to trigger and their parameters."
},
"metadata": {
"type": "object",
"description": "Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs."
}
},
"additionalProperties": false
}
},
"meta": {
"type": "object",
"properties": {
"total": {
"type": "integer",
"example": 4
}
},
"required": [
"total"
]
}
},
"additionalProperties": false
},
"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
}
]
}
}
},
"description": "Successfully took a snapshot recording"
}
}
}
},
"/__admin/scenarios": {
"get": {
"summary": "Get all scenarios",
"tags": [
"Scenarios"
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"scenarios": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The scenario ID",
"example": "c8d249ec-d86d-48b1-88a8-a660e6848042"
},
"name": {
"type": "string",
"description": "The scenario name",
"example": "my_scenario"
},
"possibleStates": {
"type": "array",
"items": {
"default": "Started",
"description": "All the states this scenario can be in",
"type": "string"
},
"example": [
"Started",
"state_1",
"state_2"
]
},
"state": {
"type": "string",
"default": "Started",
"description": "The current state of this scenario",
"example": "state_2"
}
}
}
}
}
}
}
},
"description": "All scenarios"
}
}
}
},
"/__admin/scenarios/reset": {
"post": {
"summary": "Reset the state of all scenarios",
"tags": [
"Scenarios"
],
"responses": {
"200": {
"description": "Successfully reset"
}
}
}
},
"/__admin/settings": {
"post": {
"summary": "Update global settings",
"tags": [
"System"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"allOf": [
{
"oneOf": [
{
"title": "Log normal",
"description": "Log normal randomly distributed response delay.",
"type": "object",
"properties": {
"median": {
"type": "integer"
},
"sigma": {
"type": "number"
},
"type": {
"enum": [
"lognormal"
],
"type": "string"
}
}
},
{
"title": "Uniform",
"description": "Uniformly distributed random response delay.",
"type": "object",
"properties": {
"lower": {
"type": "integer"
},
"type": {
"enum": [
"uniform"
],
"type": "string"
},
"upper": {
"type": "integer"
}
}
}
]
},
{
"type": "object",
"properties": {
"fixedDelay": {
"type": "number"
}
},
"example": {
"fixedDelay": 500
}
}
]
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Settings successfully updated"
}
}
}
},
"/__admin/reset": {
"post": {
"summary": "Reset mappings and request journal",
"description": "Reset mappings to the default state and reset the request journal",
"tags": [
"System"
],
"responses": {
"200": {
"description": "Successfully reset"
}
}
}
},
"/__admin/shutdown": {
"post": {
"description": "Shutdown the WireMock server",
"tags": [
"System"
],
"responses": {
"200": {
"description": "Server will be shut down"
}
}
}
}
},
"components": {
"requestBodies": {
"requestPattern": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
"example": {
"method": "POST",
"url": "/resource",
"headers": {
"Content-Type": {
"matches": ".*/xml"
}
}
}
}
}
},
"stubMapping": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This stub mapping's unique identifier"
},
"uuid": {
"type": "string",
"description": "Alias for the id"
},
"name": {
"type": "string",
"description": "The stub mapping's name"
},
"request": {
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
"response": {
"allOf": [
{
"type": "object",
"properties": {
"status": {
"type": "integer",
"description": "The HTTP status code to be returned"
},
"statusMessage": {
"type": "string",
"description": "The HTTP status message to be returned"
},
"headers": {
"type": "object",
"description": "Map of response headers to send"
},
"additionalProxyRequestHeaders": {
"type": "object",
"description": "Extra request headers to send when proxying to another host."
},
"body": {
"type": "string",
"description": "The response body as a string. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"base64Body": {
"type": "string",
"description": "The response body as a base64 encoded string (useful for binary content). Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"jsonBody": {
"type": "object",
"description": "The response body as a JSON object. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"bodyFileName": {
"type": "string",
"description": "The path to the file containing the response body, relative to the configured file root. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"fault": {
"type": "string",
"description": "The fault to apply (instead of a full, valid response).",
"enum": [
"CONNECTION_RESET_BY_PEER",
"EMPTY_RESPONSE",
"MALFORMED_RESPONSE_CHUNK",
"RANDOM_DATA_THEN_CLOSE"
]
},
"fixedDelayMilliseconds": {
"type": "integer",
"description": "Number of milliseconds to delay be before sending the response."
},
"delayDistribution": {
"description": "The delay distribution. Valid property configuration is either median/sigma/type or lower/type/upper.",
"oneOf": [
{
"title": "Log normal",
"description": "Log normal randomly distributed response delay.",
"type": "object",
"properties": {
"median": {
"type": "integer"
},
"sigma": {
"type": "number"
},
"type": {
"enum": [
"lognormal"
],
"type": "string"
}
}
},
{
"title": "Uniform",
"description": "Uniformly distributed random response delay.",
"type": "object",
"properties": {
"lower": {
"type": "integer"
},
"type": {
"enum": [
"uniform"
],
"type": "string"
},
"upper": {
"type": "integer"
}
}
}
]
},
"fromConfiguredStub": {
"type": "boolean",
"description": "Read-only flag indicating false if this was the default, unmatched response. Not present otherwise."
},
"proxyBaseUrl": {
"type": "string",
"description": "The base URL of the target to proxy matching requests to."
},
"transformerParameters": {
"type": "object",
"description": "Parameters to apply to response transformers."
},
"transformers": {
"type": "array",
"description": "List of names of transformers to apply to this response.",
"items": {
"type": "string"
}
}
}
}
]
},
"persistent": {
"type": "boolean",
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default."
},
"priority": {
"type": "integer",
"description": "This stub mapping's priority relative to others. 1 is highest.",
"minimum": 1
},
"scenarioName": {
"type": "string",
"description": "The name of the scenario that this stub mapping is part of"
},
"requiredScenarioState": {
"type": "string",
"description": "The required state of the scenario in order for this stub to be matched."
},
"newScenarioState": {
"type": "string",
"description": "The new state for the scenario to be updated to after this stub is served."
},
"postServeActions": {
"type": "object",
"description": "A map of the names of post serve action extensions to trigger and their parameters."
},
"metadata": {
"type": "object",
"description": "Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs."
}
},
"additionalProperties": false
},
"example": {
"request": {
"method": "GET",
"url": "/some/thing"
},
"response": {
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
},
"status": 200
}
}
}
}
},
"startRecording": {
"required": true,
"content": {
"application/json": {
"schema": {
"allOf": [
{
"type": "object",
"properties": {
"captureHeaders": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"caseInsensitive": {
"type": "boolean"
}
}
},
"description": "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",
"example": {
"Accept": {},
"Content-Type": {
"caseInsensitive": true
}
}
},
"extractBodyCriteria": {
"type": "object",
"description": "Criteria for extracting response bodies to a separate file instead of including it in the stub mapping",
"example": [
{
"binarySizeThreshold": "1 Mb",
"textSizeThreshold": "2 kb"
}
],
"properties": {
"binarySizeThreshold": {
"type": "string",
"default": "0",
"description": "Size threshold for extracting binary response bodies. Supports humanized size strings, e.g. \"56 Mb\". Default unit is bytes.",
"example": "18.2 GB"
},
"textSizeThreshold": {
"default": "0",
"description": "Size threshold for extracting binary response bodies. Supports humanized size strings, e.g. \"56 Mb\". Default unit is bytes.",
"example": "18.2 GB",
"type": "string"
}
}
},
"persist": {
"type": "boolean",
"default": true,
"description": "Whether to save stub mappings to the file system or just return them"
},
"repeatsAsScenarios": {
"type": "boolean",
"default": true,
"description": "When true, duplicate requests will be added to a Scenario. When false, duplicates are discarded"
},
"requestBodyPattern": {
"type": "object",
"description": "Control the request body matcher used in generated stub mappings",
"oneOf": [
{
"type": "object",
"description": "Automatically determine matcher based on content type (the default)",
"properties": {
"caseInsensitive": {
"type": "boolean",
"default": false,
"description": "If equalTo is used, match body use case-insensitive string comparison"
},
"ignoreArrayOrder": {
"type": "boolean",
"default": true,
"description": "If equalToJson is used, ignore order of array elements"
},
"ignoreExtraElements": {
"type": "boolean",
"default": true,
"description": "If equalToJson is used, matcher ignores extra elements in objects"
},
"matcher": {
"type": "string",
"enum": [
"auto"
]
}
}
},
{
"type": "object",
"description": "Always match request bodies using equalTo",
"properties": {
"caseInsensitive": {
"default": false,
"description": "Match body using case-insensitive string comparison",
"type": "boolean"
},
"matcher": {
"enum": [
"equalTo"
],
"type": "string"
}
}
},
{
"type": "object",
"description": "Always match request bodies using equalToJson",
"properties": {
"ignoreArrayOrder": {
"default": true,
"description": "Ignore order of array elements",
"type": "boolean"
},
"ignoreExtraElements": {
"default": true,
"description": "Ignore extra elements in objects",
"type": "boolean"
},
"matcher": {
"enum": [
"equalToJson"
],
"type": "string"
}
}
},
{
"type": "object",
"description": "Always match request bodies using equalToXml",
"properties": {
"matcher": {
"type": "string",
"enum": [
"equalToXml"
]
}
}
}
]
},
"transformerParameters": {
"type": "object",
"description": "List of names of stub mappings transformers to apply to generated stubs"
},
"transformers": {
"type": "array",
"description": "Parameters to pass to stub mapping transformers",
"items": {
"type": "string"
}
}
}
},
{
"properties": {
"filters": {
"allOf": [
{
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"\" } form",
"items": {
"type": "object"
}
}
}
},
{
"description": "Filter requests for which to create stub mapping"
}
]
},
"targetBaseUrl": {
"type": "string",
"description": "Target URL when using the record and playback API",
"example": "http://example.mocklab.io"
}
}
}
]
},
"example": {
"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"
}
}
}
}
},
"snapshotRecording": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"allOf": [
{
"type": "object",
"properties": {
"captureHeaders": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"caseInsensitive": {
"type": "boolean"
}
}
},
"description": "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",
"example": {
"Accept": {},
"Content-Type": {
"caseInsensitive": true
}
}
},
"extractBodyCriteria": {
"type": "object",
"description": "Criteria for extracting response bodies to a separate file instead of including it in the stub mapping",
"example": [
{
"binarySizeThreshold": "1 Mb",
"textSizeThreshold": "2 kb"
}
],
"properties": {
"binarySizeThreshold": {
"type": "string",
"default": "0",
"description": "Size threshold for extracting binary response bodies. Supports humanized size strings, e.g. \"56 Mb\". Default unit is bytes.",
"example": "18.2 GB"
},
"textSizeThreshold": {
"default": "0",
"description": "Size threshold for extracting binary response bodies. Supports humanized size strings, e.g. \"56 Mb\". Default unit is bytes.",
"example": "18.2 GB",
"type": "string"
}
}
},
"persist": {
"type": "boolean",
"default": true,
"description": "Whether to save stub mappings to the file system or just return them"
},
"repeatsAsScenarios": {
"type": "boolean",
"default": true,
"description": "When true, duplicate requests will be added to a Scenario. When false, duplicates are discarded"
},
"requestBodyPattern": {
"type": "object",
"description": "Control the request body matcher used in generated stub mappings",
"oneOf": [
{
"type": "object",
"description": "Automatically determine matcher based on content type (the default)",
"properties": {
"caseInsensitive": {
"type": "boolean",
"default": false,
"description": "If equalTo is used, match body use case-insensitive string comparison"
},
"ignoreArrayOrder": {
"type": "boolean",
"default": true,
"description": "If equalToJson is used, ignore order of array elements"
},
"ignoreExtraElements": {
"type": "boolean",
"default": true,
"description": "If equalToJson is used, matcher ignores extra elements in objects"
},
"matcher": {
"type": "string",
"enum": [
"auto"
]
}
}
},
{
"type": "object",
"description": "Always match request bodies using equalTo",
"properties": {
"caseInsensitive": {
"default": false,
"description": "Match body using case-insensitive string comparison",
"type": "boolean"
},
"matcher": {
"enum": [
"equalTo"
],
"type": "string"
}
}
},
{
"type": "object",
"description": "Always match request bodies using equalToJson",
"properties": {
"ignoreArrayOrder": {
"default": true,
"description": "Ignore order of array elements",
"type": "boolean"
},
"ignoreExtraElements": {
"default": true,
"description": "Ignore extra elements in objects",
"type": "boolean"
},
"matcher": {
"enum": [
"equalToJson"
],
"type": "string"
}
}
},
{
"type": "object",
"description": "Always match request bodies using equalToXml",
"properties": {
"matcher": {
"type": "string",
"enum": [
"equalToXml"
]
}
}
}
]
},
"transformerParameters": {
"type": "object",
"description": "List of names of stub mappings transformers to apply to generated stubs"
},
"transformers": {
"type": "array",
"description": "Parameters to pass to stub mapping transformers",
"items": {
"type": "string"
}
}
}
},
{
"properties": {
"filters": {
"type": "object",
"allOf": [
{
"properties": {
"ids": {
"type": "array",
"items": {
"type": "string"
}
}
},
"type": "object",
"description": "Filter requests for which to create stub mapping"
},
{
"type": "object",
"example": {
"bodyPatterns": [
{
"equalToJson": "{ \"numbers\": [1, 2, 3] }"
}
],
"headers": {
"Content-Type": {
"equalTo": "application/json"
}
},
"method": "POST",
"url": "/some/thing"
},
"properties": {
"method": {
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"url": {
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"queryParameters": {
"type": "object",
"description": "Query parameter patterns to match against in the : { \"\": \"\" } form"
},
"headers": {
"type": "object",
"description": "Header patterns to match against in the : { \"\": \"\" } form"
},
"basicAuthCredentials": {
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
},
"required": [
"username",
"password"
]
},
"cookies": {
"type": "object",
"description": "Cookie patterns to match against in the : { \"\": \"\" } form"
},
"bodyPatterns": {
"type": "array",
"description": "Request body patterns to match against in the : { \"\": \"