- Recorded requests — every request received, whether or not it matched an expectation
- Recorded expectations — expectations captured from proxied traffic
- Active expectations — expectations currently registered and eligible to match
- Logs — structured log entries for all major actions
PUT /mockserver/retrieve
Retrieve recorded requests, expectations, or log entries. Use thetype query parameter to select what to retrieve, and the optional format parameter to control the output format.
Returns: 200 OK with a JSON array (or log text) in the response body.
Query parameters
| Parameter | Values | Description |
|---|---|---|
type | REQUESTS | Recorded requests |
REQUEST_RESPONSES | Recorded requests paired with their responses | |
RECORDED_EXPECTATIONS | Expectations captured from proxied requests | |
ACTIVE_EXPECTATIONS | Currently active expectations | |
LOGS | Log entries | |
format | JSON (default) | JSON array |
JAVA | Java code that recreates the expectations | |
LOG_ENTRIES | Structured log format (for LOGS type) |
Request body (optional)
Pass a request matcher object as the body to filter results. MockServer returns only the items that match. Omit the body to retrieve everything.Retrieve all recorded requests
Retrieve requests filtered by path and method
Retrieve recorded requests and responses
Retrieve recorded expectations (from proxy traffic)
Retrieve active expectations
Retrieve log entries
Recorded expectations are populated only when MockServer is running in proxy mode and has forwarded requests. They represent what the real upstream server responded with, ready to be replayed as mocked expectations.
PUT /mockserver/clear
Clear recorded requests, active expectations, and/or logs. Use thetype query parameter to select what to clear and an optional request matcher or expectation ID to narrow the scope.
Returns: 200 OK on success.
Query parameter
| Value | Clears |
|---|---|
all (default) | Recorded requests, active expectations, and logs |
log | Recorded requests and logs only |
expectations | Active expectations only |
Clear everything matching a path
Clear logs only (keep expectations)
Clear all recorded requests and logs
Clear expectations only
Clear by OpenAPI operation
Clear by expectation ID
PUT /mockserver/reset
Remove all state from MockServer: recorded requests, active expectations, recorded expectations, and logs. Returns:200 OK.
No request body is required.
PUT /mockserver/status
Return the ports MockServer is currently listening on. Returns:200 OK with a JSON object.
PUT /mockserver/bind
Bind MockServer to one or more additional ports at runtime. Pass0 to have the OS assign a free port.
Returns: 200 OK with a JSON object listing all ports now bound (including pre-existing ones).
Bind to specific ports
Bind to free ports (OS-assigned)
Ports bound via this endpoint persist only for the lifetime of the MockServer process. They are not saved to configuration.