/
http-api-custom.ini
60 lines (53 loc) · 2.5 KB
/
http-api-custom.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
; ------------------------------------------
; 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, with decoder integrations.
; 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
; https://getkotori.org/docs/integration/
; ------------------------------------------
; Description:
;
; - Listen to HTTP POST or PUT requests
; - Receive payloads formatted as JSON or in urlencoded format
; - Decode payloads using specific decoders
; - 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/custom/airrohr
;
; will be republished to the MQTT topic
;
; mqttkit-1/testdrive/area-42/node-1/custom/airrohr.json
;
; ------------------------------------------
[mqttkit-1.http-api-custom]
enable = true
type = application
application = kotori.io.protocol.forwarder:boot
realm = mqttkit-1
source = http:/api/mqttkit-1/{address:.*}/{slot:(custom)}/{decoder:.+} [POST]
target = mqtt:/mqttkit-1/{address}/{slot}/{decoder}.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.