配置 ejabberd_http
导出 mod_http_api
handler
listen:
-
port: 5281
module: ejabberd_http
request_handlers:
"/api": mod_http_api
api 权限
无权限配置 who
配置成 all
api_permissions:
"API used from localhost allows all calls":
who:
- all
what:
- "*"
- "!stop"
- "!start
只允许localhost访问
api_permissions:
"API used from localhost allows all calls":
- who:
- ip: "127.0.0.1/8"
- what:
- "*"
- "!stop"
- "!start"
一些api需要配置 mod_admin_extra
才能使用,比如 send_message
modules:
mod_admin_extra: {}
测试api
deploy@atest:~$ curl -s POST http://localhost:5280/api/registered_vhosts | jq
[
"atest.example.com.cn"
]