To execute the end user session command, make a request using POST method for /rest/adhoc/sess-man@domain.com. The Context of what is sent, may differ depending on circumstance. For example, it may require authentication using Basic HTTP Authentication with admin credentials.
sess-man@domain.com in URL is the JID of session manager component which usually is in form of sess-man@domain where domain is hosted domain name.
To execute the command using XML content you need to set HTTP header Content-Type to application/xml
<command>
<node>http://jabber.org/protocol/admin#end-user-session</node>
<fields>
<item>
<var>accountjids</var>
<value>
<item>test@domain.com</item>
</value>
</item>
</fields>
</command>Where test@domain.com is JID of user which should be disconnected.
As a result server will return following XML:
<command>
<jid>sess-man@domain.com</jid>
<node>http://jabber.org/protocol/admin#end-user-session</node>
<fields>
<item>
<var>Notes</var>
<type>text-multi</type>
<value>Operation successful for user test@domain.com/resource</value>
</item>
</fields>
</command>This will confirm that user test@domain.com with resource resource was connected and has been disconnected.
If the user was not connected server will return following response:
<command> <jid>sess-man@domain.com</jid> <node>http://jabber.org/protocol/admin#end-user-session</node> <fields /> </command>
To execute the command using JSON you will need to set HTTP header Content-Type to application/json
{
"command" : {
"node": "http://jabber.org/protocol/admin#end-user-session",
"fields": [
{
"var" : "accountjids",
"value" : [
"test@domain.com"
]
}
]
}
}Where test@domain.com is JID of user who will be disconnected
As a result, the server will return following JSON:
{
"command" : {
"jid" : "sess-man@domain.com",
"node" : "http://jabber.org/protocol/admin#end-user-session",
"fields" : [
{
"var" : "Notes",
"type" : "text-multi",
"value" : [
"Operation successful for user test@domain.com/resource"
]
}
]
}
}To confirm that user test@domain.com with resource resource was connect and it was disconnected.
If user was not connected server will return the following response:
{
"command" : {
"jid" : "sess-man@domain.com",
"node" : "http://jabber.org/protocol/admin#end-user-session",
"fields" : []
}
}