I wish this helpful for you If you are a newbie and want to setup and ejabberd server, you should simply use hosted version of ejabberd. You can easily create your own domain on http://hosted.im You should be up and running in minutes
How ejabberd 13.10 server is better than ejabberd previous versions in terms of performance?
this one helps. ejabberd is listening for connections, and the default configuration doesn't restrict from where do they come. So yes, you can send the REST API queries from localhost. In fact, once you get this working, you can configure that listener to accept connections only from localhost.