HTTP mock server for simulating APIs — ideal for triggering difficult to reproduce backend states.

Convention

With Mockaton there’s no need to write code for wiring up your mocks. Instead, a given directory is scanned for filenames following a convention similar to the URLs. For example, for /api/company/123, the filename could be:

my-mocks-dir/api/company/[id].GET.200.json

Multiple Mock Variants

Each route can have multiple mock files. You can do that by adding comments in parentheses:

api/user(at step 1.0).GET.200.json
api/user(at step 1.1).GET.200.json

Or, based on the response status code — comments are optional in these cases:

api/login(invalid attempt).POST.401.json
api/login(locked out user).POST.423.json

Quick Start (Docker)

This will spin up Mockaton with the sample directories included in the repo mounted on the container.

git clone https://github.com/ericfortis/mockaton.git --depth 1
cd mockaton
make docker

Dashboard

Mockaton Dashboard

On the dashboard, you can:

On the other hand, there’s a Programmatic HTTP API, which is useful for setting up automated tests.