Current our API allows us to:
- Start/stop a scenario
- Checking liveness of AMOC
- Upload scenario
- List available scenarios
- Pinging every AMOC nodes from master node
- Get status of running scenario on single node
With default options API will be running on port 4000. You can set other port by OS environment variable (AMOC_api_port
), or application:set_env(amoc, api_port, PORT_NUMBER)
.
Every request need to have a header field content-type: application/json
.
In project we use Swagger so if you want current documentation in very nice format you can do GET /api-docs
.
Requests and responses format
GET /scenarios
{ "scenarios": [ScenarioName] }
POST /scenarios
with:
{ "scenario": ScenarioName, //string "module_source": ModuleSourceCode //string }
{ "compile" : "ok" | "error" }
PATCH /scenarios/:id
(:id is a module name of scenario) with:
{ "users": NumberOfUsers //integer }
{ "scenario": "started" | "wrong_json" }
GET /scenarios/:id
(:id is a module name of scenario)
{ "scenario_status": "loaded" | "running" | "finished" }
Attention: when scenario with :id
does not exists API returns 404.
GET /nodes
{ "nodes": { NodeName1: "up" | "down", NodeName2: "up" | "down", ... } }
GET /status
{ "node_status": "up" | "down" }