Search code examples
xmppejabberdejabberd-moduleejabberd-api

Where to get Ejabberd api url and host name


I am going to develop a chat application using ejabberd using ReactJs. I installed ejabberd on our server. I followed the API documentation from the below link.

https://docs.ejabberd.im/developer/ejabberd-api/admin-api/#registered-users

I want to try any api in postman before implementing. But I didn't get the API URL and host name from any of the document.

My ejabberd server admin URL is http://192.168.5.242:5280/admin

Also, I wish to use https://www.npmjs.com/package/ejabberd. But there I can see the usage of host name.

I tried so many ports instead of 5280. But not working for me.


Solution

  • But I didn't get the API URL and host name from any of the document.

    You define the port number in the ejabberd configuration file, in the 'listen' section. For example, in my case I use 5282 for mod_http_api, and path /api:

      -
        port: 5282
        module: ejabberd_http
        request_handlers:
          "/api": mod_http_api
          "/bosh": mod_bosh
          "/oauth": ejabberd_oauth
          "/rest": mod_rest
    

    My ejabberd server admin URL is http://192.168.5.242:5280/admin

    Then, if you add the lines that I have, your url for mod_http_api would be http://192.168.5.242:5282/api