Skip to content

$api->addToRoster() is not working #29

Closed

Description

@hassaan-dev

What I have tried so far?

$username = 'user1';
$jid = 'user2';
$openfire->addToRoster($username, $jid);

But I got the following error

array (size=2)

'status' => boolean false
'data' =>
array (size=1)
'message' => string 'Server error: POST http://message-server3.saedhamdan.com:9090/plugins/restapi/v1/users/user1/roster resulted in a 500 Server Error response' (length=143)

Activity

  1. changed the title [-]`$api->addToRoster()` is not working[/-] [+]$api->addToRoster() is not working[/+] on Aug 20, 2019
  2. gidkom commented on Apr 11, 2026

    @gidkom
    Owner

    Fixed in v1.2.0 (commit ae71237).

    The problem was two-fold: the library was sending name instead of the nickname field that Openfire's roster entity actually expects, and it was passing false values for unset optional parameters, which Openfire rejects with a 500.

    Both are fixed — please upgrade:

    composer require gidkom/php-openfire-restapi:^1.2
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions