; ------------------------------------------ ; Family: Protocol forwarder ; About: Versatile protocol forwarder components for bridging the gap between ; different data sinks, bus systems and serialization formats. ; ------------------------------------------ ; Name: HTTP-to-MQTT protocol forwarder, generic ; About: Suitable for data acquisition via HTTP POST/PUT requests. ; Channel: Transport: HTTP, MQTT; Format: JSON, x-www-form-urlencoded ; See also: https://getkotori.org/docs/handbook/forwarders/http-to-mqtt.html ; https://getkotori.org/docs/handbook/acquisition/protocol/http.html ; ------------------------------------------ ; Description: ; ; - Listen to HTTP POST or PUT requests ; - Receive payloads formatted as JSON or in urlencoded format ; - Forward payloads to the MQTT bus ; ; Manual: Please specify forwarding source and target parameters in URI format. ; The MQTT topic path is derived from the HTTP URI path by interpolating ; the appropriate part of the context URI. ; ; Example: In the example below, given the "address" part of the resource URI ; is "testdrive/area-42/node-1", data sent to the full URI ; ; /api/mqttkit-1/testdrive/area-42/node-1/data ; ; will be republished to the MQTT topic ; ; mqttkit-1/testdrive/area-42/node-1/data.json ; ; ------------------------------------------ [mqttkit-1.http-api-generic] enable = true type = application application = kotori.io.protocol.forwarder:boot realm = mqttkit-1 source = http:/api/mqttkit-1/{address:.*}/{slot:(data|event)} [POST] target = mqtt:/mqttkit-1/{address}/{slot}.json ; ------------------------------------------------ ; Notes about "source" and "target" parameters ; ------------------------------------------------ ; Note that the "netloc" part (i.e. for specifying hostname/port) ; in directives "source" and "target" are omitted from these uris. ; ; Kotori will only listen to the default HTTP port and forward ; payloads to the default MQTT broker. Both are specified in the ; main configuration file, usually "/etc/kotori/kotori.ini". ; ; However, this might change in the future to enable spinning ; up HTTP listeners on arbitrary ports at runtime and to allow ; publishing messages to different MQTT brokers.