diff options
author | tv <tv@krebsco.de> | 2020-04-17 22:41:53 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2020-04-17 23:11:07 +0200 |
commit | 7dfc802b753f21afcb656b13d30d49bc548ac150 (patch) | |
tree | 664d84c3f6ec28b7affc26b509ddc608bd06939d /README.md | |
parent | d6d51de7c9d54691b33a8ae9691fd0402259006a (diff) |
Reaktor.API: make configurable
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -29,3 +29,44 @@ withArgs ["config.json"] main :r +# HTTP API + + Reaktor can provide an HTTP API so external applications can control + its behavior. At the moment this is restricted to send PRIVMSGs to + registered channels. + +## Enable the HTTP API + + To enable the HTTP API, a listening address has to be configured. + This address can be a TCP port, specified like follows: + + { + "API": { + "listen": "inet://127.0.0.1:7777" + } + } + + or it can be an Unix domain socket, specified like follows: + + { + "API": { + "listen": "unix:/path/to/reaktor.sock" + } + } + +## Example usage of the HTTP API + + Let's say your reaktor instance has been configured to listen to + inet://localhost:7777, and the register plugin has been configured + to join #somechannel. Then it is possible to send a PRIVMSG to + this channel using e.g. following command: + + curl -fsSv http://localhost:7777/ \ + -H content-type:application/json \ + -d "$(jq -n '{command:"PRIVMSG",params:["#somechannel","derp!"]}')" + + And similarly if unix:/path/to/reaktor.sock has been used instead: + + curl -fsSv --unix-socket /path/to/reaktor.sock http://dontcare/ \ + -H content-type:application/json \ + -d "$(jq -n '{command:"PRIVMSG",params:["#somechannel","derp!"]}')" |