mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-07-19 11:31:13 +02:00
Updated Admin API Reference (markdown)
+141
-1
@@ -1,3 +1,143 @@
|
|||||||
# Admin API Reference
|
# Admin API Reference
|
||||||
|
The **WireMock admin API** provides functionality to define the mappings via a http interface.
|
||||||
|
In order to use this interface, you need to enable the admin interface:
|
||||||
|
|
||||||
The WireMock admin API provides functionality to define the mappings via a http interface.
|
```c#
|
||||||
|
var server = FluentMockServer.StartWithAdminInterface();
|
||||||
|
```
|
||||||
|
|
||||||
|
The following interfaces are supported:
|
||||||
|
### /__admin/mappings
|
||||||
|
The mappings defined in the mock service.
|
||||||
|
* `GET /__admin/mappings` --> Gets all defined mappings
|
||||||
|
* `POST /__admin/mappings` --> Create a new stub mapping
|
||||||
|
* `DELETE /__admin/mappings` --> TODO
|
||||||
|
* `GET /__admin/mappings/{guid}` --> Get a single stub mapping
|
||||||
|
* `PUT /__admin/mappings/{guid}` --> TODO
|
||||||
|
* `POST /__admin/mappings/{guid}` --> TODO
|
||||||
|
* `DELETE /__admin/mappings/{guid}` --> TODO
|
||||||
|
|
||||||
|
### /__admin/requests
|
||||||
|
Logged requests and responses received by the mock service.
|
||||||
|
* `GET /__admin/requests` --> Get received requests
|
||||||
|
* `GET /__admin/requests/{requestId}` --> TODO
|
||||||
|
* `POST /__admin/requests/reset` --> TODO
|
||||||
|
* `POST /__admin/requests/count` --> TODO
|
||||||
|
* `POST /__admin/requests/find` --> TODO
|
||||||
|
* `GET /__admin/requests/unmatched` --> TODO
|
||||||
|
* `GET /__admin/requests/unmatched/near-misses` --> TODO
|
||||||
|
|
||||||
|
## /__admin/mappings
|
||||||
|
The mappings defined in the mock service.
|
||||||
|
|
||||||
|
### `GET /__admin/mappings`
|
||||||
|
Gets all defined mappings.
|
||||||
|
|
||||||
|
Example request:
|
||||||
|
`GET http://localhost/__admin/mappings`
|
||||||
|
|
||||||
|
Example response:
|
||||||
|
```js
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"Guid": "be6e1db8-cb95-4a15-a836-dcd0092b34a0",
|
||||||
|
"Request": {
|
||||||
|
"Url": {
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "WildcardMatcher",
|
||||||
|
"Pattern": "/data"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Methods": [
|
||||||
|
"get"
|
||||||
|
],
|
||||||
|
"Headers": [
|
||||||
|
{
|
||||||
|
"Name": "Content-Type",
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "WildcardMatcher",
|
||||||
|
"Pattern": "application/*"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Cookies": [],
|
||||||
|
"Params": [
|
||||||
|
{
|
||||||
|
"Name": "start",
|
||||||
|
"Values": [ "1000", "1001" ]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Body": {}
|
||||||
|
},
|
||||||
|
"Response": {
|
||||||
|
"StatusCode": 200,
|
||||||
|
"Body": "{ \"result\": \"Contains x with FUNC 200\"}",
|
||||||
|
"UseTransformer": false,
|
||||||
|
"Headers": {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Guid": "90356dba-b36c-469a-a17e-669cd84f1f05",
|
||||||
|
"Request": {
|
||||||
|
"Url": {
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "WildcardMatcher",
|
||||||
|
"Pattern": "/*"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Methods": [
|
||||||
|
"get"
|
||||||
|
],
|
||||||
|
"Headers": [],
|
||||||
|
"Cookies": [],
|
||||||
|
"Params": [
|
||||||
|
{
|
||||||
|
"Name": "start",
|
||||||
|
"Values": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Body": {}
|
||||||
|
},
|
||||||
|
"Response": {
|
||||||
|
"StatusCode": 200,
|
||||||
|
"Body": "{\"msg\": \"Hello world, {{request.path}}\"",
|
||||||
|
"UseTransformer": true,
|
||||||
|
"Headers": {
|
||||||
|
"Transformed-Postman-Token": "token is {{request.headers.Postman-Token}}",
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### `GET /__admin/mappings` --> Gets all defined mappings
|
||||||
|
### `POST /__admin/mappings` --> Create a new stub mapping
|
||||||
|
### `DELETE /__admin/mappings` --> TODO
|
||||||
|
### `GET /__admin/mappings/{guid}` --> Get a single stub mapping
|
||||||
|
### `PUT /__admin/mappings/{guid}` --> TODO
|
||||||
|
### `POST /__admin/mappings/{guid}` --> TODO
|
||||||
|
### `DELETE /__admin/mappings/{guid}` --> TODO
|
||||||
|
|
||||||
|
## /__admin/requests
|
||||||
|
Logged requests and responses received by the mock service.
|
||||||
|
### `GET /__admin/requests` --> Get received requests
|
||||||
|
### `GET /__admin/requests/{requestId}` --> TODO
|
||||||
|
### `POST /__admin/requests/reset` --> TODO
|
||||||
|
### `POST /__admin/requests/count` --> TODO
|
||||||
|
### `POST /__admin/requests/find` --> TODO
|
||||||
|
### `GET /__admin/requests/unmatched` --> TODO
|
||||||
|
### `GET /__admin/requests/unmatched/near-misses` --> TODO
|
||||||
|
|||||||
Reference in New Issue
Block a user