Stub Mapping 列表,不包含统计信息。
```
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.mock.com/stub-mappings.json",
"type": "object",
"title": "stub-mappings",
"description": "StubMapping 列表。",
"readOnly": true,
"writeOnly": false,
"properties": {
"mappings": {
"$id": "mappings",
"type": "array",
"properties": {
"id": {
"$id": "mappings[0].id",
"type": "string",
"description": "stub mapping 的唯一标识"
},
"priority": {
"$id": "mappings[0].priority",
"type": "integer",
"description": "该 stub mapping 相对于其他 stub mapping的优先级,最高为1。",
"minimum": 1
},
"persistent": {
"$id": "mappings[0].persistent",
"type": "boolean",
"description": "Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default."
},
"scenarioName": {
"$id": "mappings[0].scenarioName",
"type": "string",
"description": "The name of the scenario that this stub mapping is part of"
},
"requiredScenarioState": {
"$id": "mappings[0].requiredScenarioState",
"type": "string",
"description": "The required state of the scenario in order for this stub to be matched."
},
"newScenarioState": {
"$id": "mappings[0].newScenarioState",
"type": "string",
"description": "The new state for the scenario to be updated to after this stub is served."
},
"postServeActions": {
"$id": "mappings[0].postServeActions",
"type": "object",
"description": "A map of the names of post serve action extensions to trigger and their parameters."
},
"metadata": {
"$id": "mappings[0].metadata",
"type": "object",
"description": "Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs."
},
"request": {
"$id": "mappings[0].request",
"type": "object",
"properties": {
"url": {
"$id": "mappings[0].request.url",
"type": "string",
"description": "The path and query to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPattern": {
"$id": "mappings[0].request.urlPattern",
"type": "string",
"description": "The path and query regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPath": {
"$id": "mappings[0].request.urlPath",
"type": "string",
"description": "The path to match exactly against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"urlPathPattern": {
"$id": "mappings[0].request.urlPathPattern",
"type": "string",
"description": "The path regex to match against. Only one of url, urlPattern, urlPath or urlPathPattern may be specified."
},
"method": {
"$id": "mappings[0].request.method",
"type": "string",
"description": "The HTTP request method e.g. GET"
},
"headers": {
"$id": "mappings[0].request.headers",
"type": "object",
"description": "Header patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form"
},
"queryParameters": {
"$id": "mappings[0].request.queryParameters",
"type": "object",
"description": "Query parameter patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form"
},
"cookies": {
"$id": "mappings[0].request.cookies",
"type": "object",
"description": "Cookie patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form"
},
"bodyPatterns": {
"$id": "mappings[0].request.bodyPatterns",
"type": "array",
"description": "Request body patterns to match against in the <key>: { \"<predicate>\": \"<value>\" } form",
"items": {
"$id": "mappings[0].request.bodyPatterns[0]",
"type": "object"
}
},
"basicAuthCredentials": {
"$id": "mappings[0].request.basicAuthCredentials",
"type": "object",
"description": "Pre-emptive basic auth credentials to match against",
"required": [
"username",
"password"
],
"properties": {
"username": {
"$id": "mappings[0].request.basicAuthCredentials.username",
"type": "string"
},
"password": {
"$id": "mappings[0].request.basicAuthCredentials.password",
"type": "string"
}
}
}
}
},
"response": {
"$id": "mappings[0].response",
"type": "object",
"properties": {
"status": {
"$id": "mappings[0].response.status",
"type": "integer",
"description": "The HTTP status code to be returned"
},
"statusMessage": {
"$id": "mappings[0].response.statusMessage",
"type": "string",
"description": "The HTTP status message to be returned"
},
"body": {
"$id": "mappings[0].response.body",
"type": "string",
"description": "The response body as a string. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"headers": {
"$id": "mappings[0].response.headers",
"type": "object",
"description": "Map of response headers to send"
},
"jsonBody": {
"$id": "mappings[0].response.jsonBody",
"type": "object",
"description": "The response body as a JSON object. Only one of body, base64Body, jsonBody or bodyFileName may be specified."
},
"bodyFileName": {
"$id": "mappings[0].response.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."
},
"base64Body": {
"$id": "mappings[0].response.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."
},
"additionalProxyRequestHeaders": {
"$id": "mappings[0].response.additionalProxyRequestHeaders",
"type": "object",
"description": "Extra request headers to send when proxying to another host."
},
"fixedDelayMilliseconds": {
"$id": "mappings[0].response.fixedDelayMilliseconds",
"type": "integer",
"description": "Number of milliseconds to delay be before sending the response."
},
"delayDistribution": {
"$id": "mappings[0].response.delayDistribution",
"type": "object",
"description": "Random delay settings."
},
"fault": {
"$id": "mappings[0].response.fault",
"type": "string",
"enum": [
"CONNECTION_RESET_BY_PEER",
"EMPTY_RESPONSE",
"MALFORMED_RESPONSE_CHUNK",
"RANDOM_DATA_THEN_CLOSE"
],
"description": "The fault to apply (instead of a full, valid response)."
},
"proxyBaseUrl": {
"$id": "mappings[0].response.proxyBaseUrl",
"type": "string",
"description": "The base URL of the target to proxy matching requests to."
},
"transformers": {
"$id": "mappings[0].response.transformers",
"type": "array",
"description": "List of names of transformers to apply to this response.",
"items": {
"$id": "mappings[0].response.transformers[0]",
"type": "string"
}
},
"transformerParameters": {
"$id": "mappings[0].response.transformerParameters",
"type": "object",
"description": "Parameters to apply to response transformers."
},
"fromConfiguredStub": {
"$id": "mappings[0].response.fromConfiguredStub",
"type": "boolean",
"description": "Read-only flag indicating false if this was the default, unmatched response. Not present otherwise."
}
}
}
}
}
}
}
```
- Admin API
- Stub Mapping API
- /mappings
- GET
- POST
- DELETE
- /mappings/reset
- /mappings/{stubMappingId}
- GET
- PUT
- DELETE
- /mocklab/mappings/normal
- /mocklab/mappings/notify
- Record API
- /recordings/start
- /recordings/stop
- /recordings/status
- /recordings/snapshot
- Settings API
- /mocklab/settings
- JSON Schema
- Stub Mapping
- Stub Mappings
- Stub Mappings meta
- 官方 API 文档
- 文章模板
- API 文章模板