#####INCLUDE z.upperside.html

REST API Reference Generated by AI

What this page is for. This is the reference for scripts, CI pipelines and any HTTP client that sets up or inspects MockMotor mocks without the console: seeding environments before a test run, loading accounts in bulk, reading the execution log, or checking what a reaction returned. It lists every endpoint under /console/api/, its method, its parameters and the result shape. Changes made through the API take effect on the running server immediately. If you are an AI agent, use the MCP Tools Reference instead, which covers the same operations as MCP tools.

Alongside the MCP server, MockMotor exposes the same environment/service/reaction/account management as a plain REST API under /console/api/ — JSON over HTTP, no JSON-RPC envelope required, for scripts, CI pipelines, or any HTTP client that doesn't speak MCP. Every endpoint here calls the exact same server-side logic as its MCP tool counterpart (the same *Handler classes), so the two stay behaviourally identical — only the transport differs.

This page pulls its field-level documentation live from the MCP server's own tools/list response (see MCP Tools Reference), so parameter and result descriptions always match what the server actually validates — only the HTTP method/path framing below is REST-specific.

Conventions used by every endpoint below

Lessons learned

Field notes from real agent sessions against this server — things that aren't obvious from the schema alone. These apply the same whether you're calling the REST endpoints below or the equivalent MCP tools, since both go through the same server-side logic.

Authentication failure modes are distinguishable — use them to diagnose
Don't use JS dot-notation on input for XML/SOAP bodies

For SOAP/XML payloads, use XQuery instead: $input//*:fieldName (wildcard-namespace match) reliably extracts fields regardless of the request's namespace prefixes, e.g. $input//*:ban[starts-with(.,'6')].

The $accounts variable is a single wrapper element, not a sequence

In a payload/response script it has the shape <accounts><account>...</account><account>...</account></accounts>. Iterate with for $a in $accounts/account, not for $a in $accounts (the latter silently loops exactly once, over the wrapper). Each <account> exposes its properties as direct child elements ($a/BAN, $a/SUB, ...) plus an <ID> element. This differs from the singular $account bound per-candidate inside accountsSelectorScript during selection.

maxAccounts defaults to 1

If a reaction needs to bind more than one matching account (e.g. multiple subscriber rows per key), explicitly raise maxAccounts, or only the first match is ever used regardless of how many accounts actually match.

Prefer accounts-driven matching over a hardcoded matchByScript whitelist

...when a reaction's response is generated from mock account data. A hardcoded OR-chain of known keys requires editing the reaction every time mock data changes, and silently drifts out of sync (new accounts added via create_account won't be served until the reaction is manually updated). Instead:

POST /console/api/reactionDebug is the primary diagnostic tool

It returns a step-by-step trace (Match by HTTP Method, Match by FirstPayloadElement, Script XQ/Script JS, Match by Script, Executed/Skipped reaction) that pinpoints exactly which stage failed and why. When a variable's structure is unclear, dump it directly as a temporary diagnostic payload (e.g. <Debug>{ for $a in $accounts return <acc>{$a}</acc> }</Debug>) rather than guessing.

New reactions are inserted first in evaluation order

Creating a reaction places it before all existing reactions. This is useful for overriding a generated default, but means an overly broad matcher will shadow every request matching its base criteria — scope it precisely with matchByScript/accountsSelectorScript rather than relying on order alone.

Loading field documentation from /console/api/mcp…
#####INCLUDE z.footer.html