Skip to content

Management API

The PHANTOM® Gateway Gen2 Management API gives you full access to every feature and control of the gateway. It is the same API the Gateway Admin Console uses, so anything you can do in the admin GUI you can do through the API:

  • change gateway settings
  • observe the current state of every sensor
  • change sensor configuration
  • request on-demand time waveforms from vibration sensors

It is available over two transports that speak the same JSON protocol:

Transport Use when
WebSocket You can reach the gateway’s IP directly. State is pushed continuously
MQTT The gateway is behind a broker, or you manage several gateways
ws://GATEWAY-IP-ADDR/realtime

Connect with any WebSocket client library. You will receive updates from the gateway and can issue commands over the same connection.

All messages are JSON and every message starts with a type property. How you handle a message depends on that property.

The gateway pushes its state in two message types, and the second only makes sense if you kept the first:

1. On connect — the complete state
{
"type": "stateupdate",
"payload": {
"nodes": {},
"deviceInfo": {},
"phantomSync": [],
"basicconfig": {}
}
}
2. Afterwards — incremental changes
{
"type": "statepatch",
"payload": [
{ "op": "replace", "path": "/nodes/189281421/rssi", "value": -50 }
]
}

Most WebSocket-capable languages have a JSON Patch library (fast-json-patch in JavaScript, jsonpatch in Python, JsonPatch in .NET).

Commands go over the same socket, as JSON:

{ "type": "observeerequest", "phantomcode": "189281421", "action": "signal" }

The type is always observeerequest. The action selects the command and the remaining parameters depend on it. The example above requests a time waveform from sensor 189281421.

See Commands for the full list, and The state object for what the gateway reports back.