Project

General

Profile

Get user roster mistery

István Tóth
Added over 3 years ago

Hi all

I try to get an user's roster.

If I check the web admin field, at management/other/get user's roster , I fill out the field, and in the browser, I get only a result field with the user's JID.

I check the XML communication with firebug, and in the answer, there is the result with the roster data, but not displayed as a query result.

I try to get the user's roster with ad-hoc command, JSON post, and cannot figure out, what kind of data missing from post, to get the roster data.

The example from here: https://projects.tigase.org/projects/tigase-http-api/wiki/Usage_examples working well, if I want to get the online users list, with JSON post:

{ 
  "command" : {
    "node" : "http://jabber.org/protocol/admin#get-active-users",
    "fields" : [
      {
        "var" : "domainjid",
        "value" : "domain.com" 
      },
      {
        "var" : "max_items",
        "value" : "25" 
      }
    ]
  }
}

That is okay.

But If I want to change this to get the user's roster:

{"command" : {
    "node" : "http://jabber.org/protocol/admin#get-user-roster",
    "fields" : [
      {
        "var" : "accountjid",
        "value" : "user@domain.com" 
      }
    ]
  }
}

The result is only the given account JID.

There is any other field should be posted with the request? Or that is enough? I try out a lot of possibilities with fields, contents and format, but I can't get the roster items.


Replies (3)

Added by Wojciech Kapcia TigaseTeam over 3 years ago

This is because groovy script returns whole user roster element, and doesn't enclose it in the Form element, thus http-api component doesn't include it in the response.

Added by István Tóth over 3 years ago

Okay, I get this result in JSON

I request the admin's roster, and this look like all the result...

 { "command": { "jid": "sess-man@myserver.com", "node": "http://jabber.org/protocol/admin#get-user-roster", "fields": [ { "var": "accountjid", "label": "jid-single", "value": "admin@myserver.com" } ] } }

There is any way to get the roster items too? Or probably just error in the CURL request?

Added by Wojciech Kapcia TigaseTeam over 3 years ago

It's not the error in CURL request.

Admin ad-hoc script (which is being called through REST API) returns all items directly in the response and doesn't enclose them in the Data Form (only JID is in that element) and because of how REST API is implemented - it only includes items included in the data form in the response, hence roster items are not included in the response from REST API.

I've created #3490 and added you as a watcher.

    (1-3/3)