For instructions on how to enable login history please see the section called “Enabling login history” section.
To retrieve collections with informations about user logins item-type
attribute needs to be added to <list/>
element from section 7.1 Retrieving a List of Collections of XEP-0136 specification with value set to login
.
A result it will be returned as specified in XEP-0136, but <list/>
element will contain <events/>
element for each collections instead of <chat/>
element.
Additionally <list/>
element will have item-type
attribute set to login
.
Request to retrieve collection of login events of juliet@capulet.com
between 2014-01-01 00:00:00
and 2014-05-01 00:00:00
(sent from juliet@capilet.com
account)
<iq type="get" id="query1"> <list xmlns='urn:xmpp:archive' with='juliet@capulet.com' start='2014-01-01T00:00:00Z' end='2014-05-01T00:00:00Z' item-type='login'/> </iq>
Response with single collection starting at 2014-02-01 13:01:34
<iq type="result" id="query2"> <list xmlns='urn:xmpp:archive' item-type='login'> <events with='juliet@capulet.com' start='2014-02-01T13:01:34Z'/> <set xmlns="http://jabber.org/protocol/rsm"> <first index='0'>0</first> <last>0</last> <count>1</count> </set> </events> </iq>
To retrieve items with informations about user logins from collection item-type
attribute needs to be added to <retrieve/>
element from section 7.2 Retrieving a Collection of XEP-0136 specification with value set to login
.
A result will be returned as specified in XEP-0136, but instead of <chat/>
element <events/>
element will be returned.
Moreover instead of message subelements in <from/>
element, there will be custom element containing information about session, ie. <bind/>
element with connection resource set as a value. There will be also type
attribute added to <from/>
element with value set to login
to mark that this is login
event.
Request to retrieve login events of juliet@capulet.com
between 2014-02-01 13:00:00
and 2014-05-01 00:00:00
(sent from juliet@capilet.com
account)
<iq type="get" id="query1"> <retrieve xmlns='urn:xmpp:archive' with='juliet@capulet.com' start='2014-02-01T13:00:00Z' end='2014-05-01T00:00:00Z' item-type='login'/> </iq>
Response with single login entry at 2014-02-01 13:01:34 with call SID.
<iq type="result" id="query2"> <events xmlns='urn:xmpp:archive' with='juliet@capulet.com' start='2014-02-01T13:00:00Z' item-type='login'> <from secs='94' item-type='login'><bind>balcony</bind></from> <set xmlns="http://jabber.org/protocol/rsm"> <first index='0'>0</first> <last>0</last> <count>1</count> </set> </events> </iq>