Use the REST API plugin
To enable REST API plugin on Openfire follow the next steps:
Log in to the Openfire Administration Panel.
Install the REST API plugin as explained in the instructions.
Browse to the “Server -> Server Settings -> REST API” menu item. Mark “Enabled - REST API requests will be processed” and click the “Save Settings” button.
Once you have installed and enabled the API REST plugin you will be able to send API requests to the Openfire Server.