Sending Requests
Topic Structure
Requests
mPower API requests should be sent to the topic:
gateware/[conduit_serial|broadcast]/mpower/[method]
The conduit_serial
is the serial number of the Conduit. Alternatively, the broadcast
topic can be used to send the request to all Conduits.
The method
is the HTTP method to use for the request. The following methods are supported:
get
post
put
delete
Responses
mPower API responses will be sent to the topic:
gateware/[conduit_serial]/mpower/[method]
Message Format
Requests
Refer to the mPower API documentation for API details: https://www.multitech.net/developer/software/mtr-software/mtr-api-reference/collection-endpoints/
The message payload should be a JSON object with the following fields:
{
"headers": [],
"message_id": "unique message id",
"payload": "{}",
"query_string": "status",
"topic": "gateware/21560532/mpower/get"
}
headers
- An array of HTTP headers to send with the request. Each header is a string, for example:Header: value
.message_id
- A unique message id. This is used to correlate the request with the response.payload
- The payload to send with the request. This is optional and can be an empty string.query_string
- The value ofquery_string
will be appended to the URL of the request. For example, if thequery_string
isstatus
, the URL of the request will behttps://127.0.0.1/api/status
.topic
- only required for Azure, where the MQTT topic is not available. The value oftopic
will be used as a replacement for the MQTT topic.
Responses
{
"topic": "gateware/21560532/mpowerresponse/get",
"payload": {
"code": 200,
"result": [],
"status": "success"
},
"message_id": ""
}