powered by Jive Software

Can't add user to chatroom (as a member) using the rest API

Hi, I’m trying to use the rest api to add a user to a chatroom programatically, the problem is that the api is returning a 500 error, and when I look at the logs, it says that it’s not allowed:

org.jivesoftware.openfire.plugin.rest.exceptions.RESTExceptionMapper - NotAllowedException: Could not add member with resource user@server.local

This is the request I’m trying to execute:

curl -v -H 'Authorization: Basic XXXX' -H 'Content-type: text/xml' -d '' \
 http://localhost:9090/plugins/restapi/v1/chatrooms/room_test/members/user@server.local?servicename=conference

Is there anything I’m doing wrong here? or anything I should change in the room settings?

Found the issue. If the settings in the room have “Only login with registered nickname” set, then it will throw the NotAllowed exception. Un-checking that option allowed me to register users using the API.