Web API for Mira Gateway and monitoring data¶
The Mira Gateway API service program will provide a web API for the data from the Mira Gateway and Mira Monitoring Receiver.
The API¶
The service will publish documentation, and schemas, about the API at the `/docsĀ“ path.
Prerequisites¶
Mira Gateway running with the monitor db enabled.
Configuration file¶
The configuration file is using the toml format.
Configure the following fields:
gw_monitor_db = "<path>" # Path including name of the gateway monitor database
[influx_config] # Configuration needed to connect to the Influx database
url = "<url>" # URL to the database, usually "http://localhost:8086"
bucket_name = "<bucket>" # Name of the bucket/database created in Influx
auth_token = "<token>" # Authentication token for the Influx server
[api_config]
ip_address = "<adress>" # IPv4 address the service will listen to. Use "0.0.0.0" for all addresses
port = <port> # The port the service will listen to.
The same configuration file works with the Mira Monitoring Receiver service. By using the same file to both services, there is less risk of having incorrect configuration.
How to run¶
First start the gateway and optionally the monitoring receiver.
Then run the gateway_api
executable:
Without the monitoring receiver, some data will not be available.
The service will now start to listen for web requests.