Search code examples
resterlangxmppejabberd

Configure mod_rest module for the ejabberd server


I am in the process of configuring the ejabber server for one of our project.In this we need to configure the mod_rest module (https://github.com/processone/ejabberd-contrib) from ejabberd-contrib. Below are my configuration (YAML) in listen

 port: 5280
    module: ejabberd_http
    request_handlers:
      "/rest": mod_rest
    web_admin: true
    http_poll: true
    http_bind: true
    ## register: true
    captcha: true


modules:
  mod_rest:
    allowed_ips:
      - "host_one_ip"
      - "host_one_ip"
    access_commands:
      - "registered_users"
      - "connected_users"
    allowed_destinations:
      - "all"

But whenever i am trying to hit the ejabberd command using the rest (curl call) its giving me "TryPOSTING Stanza"

    prompt# curl --data 'registered_users domain' -X POST http://host:5280/rest/

Try POSTing a stanza. 

I tried to go though the forum but couldn't find ...anything helpful

I am new to ejabber and erlang. Any pointer in this direction will be very helpful. Please let me know if any more details are required.


Solution

  • Guys i have figured out the issue for this. I have installed Ejabberd 14.05 version. The mod_rest module was including the ejabberd_http.hrl file for its dev_include directories.In the Ejabberd 14.05 the record for ejabberd_http.hrl are changed. "opts = [] :: list()," is an extra header in the ejabber-contrib`s include folder. I adjusted the header location accordingly and compile the module. It worked for me :) with this i got the ejabberd commands working using the mod_rest. Now my i facing problem to consumes Stanzas using mod_rest :(. If anyone have any thoughts on the same please let me know.