Openfire 5.0.2 RestApi 1.12.0 Issues

There is a problem when creating a user and assigning groups to them. When creating a user, it is created normally, but when changing or adding groups to it, I get error 400 The ofrestapi python module is used. There were no problems on older versions. Occurs precisely when groups are changed or created.

>>> from ofrestapi.users import Users 
>>> api = Users('http://xx.xx.xx.xx:9090', 'key') 
>>> x = api.add_user(username='test', password='123456', name='test') 
>>> of_groups = \[\] 
>>> of_groups.append('ca') 
>>> of_groups.append('it') 
>>> api.add_user_groups(username='test', groups=of_groups.lower()) 
Traceback (most recent call last): 
 File "<stdin>", line 1, in <module> 
AttributeError: 'list' object has no attribute 'lower' 
>>> api.add_user_groups(username='test', groups=of_groups) 
Traceback (most recent call last): 
 File "/home/urr_karpenkovav/disk_d/Programing/Site/django/workprogs/venv/lib/python3.11/site-packages/requests/models.py", line 974, in json 
   return complexjson.loads(self.text, \*\*kwargs) 
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
 File "/usr/lib/python3.11/json/\__init_\_.py", line 346, in loads 
   return \_default_decoder.decode(s) 
          ^^^^^^^^^^^^^^^^^^^^^^^^^^ 
 File "/usr/lib/python3.11/json/decoder.py", line 337, in decode 
   obj, end = self.raw_decode(s, idx=\_w(s, 0).end()) 
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
 File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode 
   raise JSONDecodeError("Expecting value", s, err.value) from None 
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 

During handling of the above exception, another exception occurred:

Traceback (most recent call last): 
 File "/home/urr_karpenkovav/disk_d/Programing/Site/django/workprogs/venv/lib/python3.11/site-packages/ofrestapi/base.py", line 60, in \_submit_request 
   exception = r.json()\['exception'\] 
               ^^^^^^^^ 
 File "/home/urr_karpenkovav/disk_d/Programing/Site/django/workprogs/venv/lib/python3.11/site-packages/requests/models.py", line 978, in json 
   raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) 
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 

During handling of the above exception, another exception occurred:

Traceback (most recent call last): 
 File "<stdin>", line 1, in <module> 
 File "/home/urr_karpenkovav/disk_d/Programing/Site/django/workprogs/venv/lib/python3.11/site-packages/ofrestapi/users.py", line 117, in add_user_groups 
   return self.\_submit_request(post, endpoint, json=payload) 
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
 File "/home/urr_karpenkovav/disk_d/Programing/Site/django/workprogs/venv/lib/python3.11/site-packages/ofrestapi/base.py", line 63, in \_submit_request 
   raise InvalidResponseException(r.status_code) 
ofrestapi.exception.InvalidResponseException: 400 
>>>

I am not familiar with Python, nor with the python module. I’m not sure which module you use, but I am sure that it must be third-party code (as we don’t produce python modules). You may want to ask their developer to have a look at this issue, too.

To further diagnose the issue, it would be helpful if you could share the HTTP requests and responses that are exchanged with the server. Also, please provide any log files from Openfire. What was the newest combination of Openfire and plugin versions that will work?

I looked at the documentation of the old version of restapi and the new version of restapi, and in terms of adding groups there, the logic didn’t seem to change. Maybe this is due to a change in the part that when you create a user natively, there is a line indicating the group?

How can i do this?

This modules work with Openfire 4.6.2 and RestApi 1.4.0

Openfire logs can be found as flat text files on your computer, typically in a directory called logs in the Openfire installation directory (some operating systems place these in /var/log/).

To capture HTTP requests and responses, it is probably best to use some kind of packet interceptor. You may be able to do that in your python code, or with something like Wireshark.

Openfire 4.6.2 and RestAPI 1.4.0 are both (very) old. Is there a newer (but not newest) combination that still works for you?

Only this errors in logs now

2025.10.01 13:50:36.854 WARN [pep-worker-3]: org.jivesoftware.openfire.pubsub.DefaultPubSubPersistenceProvider - Subscription found for a non-existent affiliate: kuznecova@vm-openfire.urr68.esk in node: UniqueIdentifier{serviceId=‘mesheryakova@vm-openfire.urr68.esk’, nodeId=‘mesheryakova@vm-openfire.urr68.esk’}
2025.10.01 13:50:36.854 WARN [pep-worker-3]: org.jivesoftware.openfire.pubsub.DefaultPubSubPersistenceProvider - Subscription found for a non-existent affiliate: kobzevaira@vm-openfire.urr68.esk in node: UniqueIdentifier{serviceId=‘mesheryakova@vm-openfire.urr68.esk’, nodeId=‘mesheryakova@vm-openfire.urr68.esk’}
2025.10.01 13:50:36.854 WARN [pep-worker-3]: org.jivesoftware.openfire.pubsub.DefaultPubSubPersistenceProvider - Subscription found for a non-existent affiliate: makushkina@vm-openfire.urr68.esk in node: UniqueIdentifier{serviceId=‘mesheryakova@vm-openfire.urr68.esk’, nodeId=‘mesheryakova@vm-openfire.urr68.esk’}
2025.10.01 13:50:36.854 WARN [pep-worker-3]: org.jivesoftware.openfire.pubsub.DefaultPubSubPersistenceProvider - Subscription found for a non-existent affiliate: ivonina@vm-openfire.urr68.esk in node: UniqueIdentifier{serviceId=‘mesheryakova@vm-openfire.urr68.esk’, nodeId=‘mesheryakova@vm-openfire.urr68.esk’}
2025.10.01 13:50:36.854 WARN [pep-worker-3]: org.jivesoftware.openfire.pubsub.DefaultPubSubPersistenceProvider - Subscription found for a non-existent affiliate: urr_tyulenevass@vm-openfire.urr68.esk in node: UniqueIdentifier{serviceId=‘mesheryakova@vm-openfire.urr68.esk’, nodeId=‘mesheryakova@vm-openfire.urr68.esk’}
2025.10.01 13:50:36.854 WARN [pep-worker-3]: org.jivesoftware.openfire.pubsub.DefaultPubSubPersistenceProvider - Subscription found for a non-existent affiliate: verkoshanskaya@vm-openfire.urr68.esk in node: UniqueIdentifier{serviceId=‘mesheryakova@vm-openfire.urr68.esk’, nodeId=‘mesheryakova@vm-openfire.urr68.esk’}
2025.10.01 13:50:36.854 WARN [pep-worker-3]: org.jivesoftware.openfire.pubsub.DefaultPubSubPersistenceProvider - Subscription found for a non-existent affiliate: kp_kartashova@vm-openfire.urr68.esk in node: UniqueIdentifier{serviceId=‘mesheryakova@vm-openfire.urr68.esk’, nodeId=‘mesheryakova@vm-openfire.urr68.esk’}
2025.10.01 13:50:36.854 WARN [pep-worker-3]: org.jivesoftware.openfire.pubsub.DefaultPubSubPersistenceProvider - Subscription found for a non-existent affiliate: belovati@vm-openfire.urr68.esk in node: UniqueIdentifier{serviceId=‘mesheryakova@vm-openfire.urr68.esk’, nodeId=‘mesheryakova@vm-openfire.urr68.esk’}

def init(self, host, secret, endpoint=‘/plugins/restapi/v1/users’):
“”"
:param host: Scheme://Host/ for API requests
:param secret: Shared secret key for API requests
:param endpoint: Endpoint for API requests
“”"
super(Users, self).init(host, secret, endpoint)

this code creates groups

def add_user_groups(self, username, groups):
“”"
Add user to one or more groups

    :param username: The user name
    :param groups: One or more groups to be added in
    :type groups: List of strings. E.g. ['Admins','Friends']
    """
    endpoint = '/'.join([self.endpoint, username, 'groups'])
    payload = {
        'groupname': groups,
    }
    return self._submit_request(post, endpoint, json=payload)

add new code for additing one group to user

def add_user_group(self, username, group):
        """
        Add user to one group

        :param username: The user name
        :param group: One group to be added in
        :type groups: List of strings. E.g. ['Admins','Friends']
        """
        endpoint = '/'.join([self.endpoint, username, 'groups', group])
        return self._submit_request(post, endpoint)

This works fine.

But multiple groups not work

And this happens if I delete a user’s group.

At the same time, if I delete a user from the group, then everything is fine.

I am afraid that I do not understand most of what you’re writing.

All I mean is that one group is added and everything is fine, but adding multiple groups at once is broken.