How to get Last Logged In User for a device from N-able N-central API using SOAP calls

Last Modified

Fri Jan 24 13:51 GMT 2020

Description

  • How to get Last Logged In User for a device from N-able N-central API using SOAP calls

Environment

  • N-able N-central 12.1.0.744 or later (EI2 WSDL)

Solution

  1. See this article for assistance setting up the WSDL in your application of choice: https://documentation.n-able.com/N-central/troubleshooting/Content/kb/Accessing-N-able-N-central-API-functions
  2. Observe the Documentation for DeviceList (by searching https://yourservername.com/dms > javadoc):






  3. Make a soap call as follows:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ei2="http://ei2.nobj.nable.com/">
<soap:Header/>
<soap:Body>
<ei2:deviceList>
<ei2:username>productadmin@n-able.com</ei2:username>
<ei2:password>**************</ei2:password>
<ei2:settings>
<ei2:key>customerid</ei2:key>
<ei2:value>957</ei2:value>
</ei2:settings>
<ei2:settings>
<ei2:key>devices</ei2:key>
<ei2:value>true</ei2:value>
</ei2:settings>
</ei2:deviceList>
</soap:Body>
</soap:Envelope>


//Example Response:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<deviceListResponse xmlns="http://ei2.nobj.nable.com/">
<return>
<info>
<first xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">device.deviceid</first>
<second xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">2072602486</second>
<key>device.deviceid</key>
<value>2072602486</value>
</info>
<info>
<first xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">device.uri</first>
<second xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">somenetworkaddress</second>
<key>device.uri</key>
<value>somenetworkaddress</value>
</info>
...
<info>
<first xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">device.longname</first>
<second xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Agent Test Device1</second>
<key>device.longname</key>
<value>Agent Test Device1</value>
</info>


...
<items>
<first xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">device.lastloggedinuser</first>
<second xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">domain\dave.thomas</second>
<key>device.lastloggedinuser</key>
<value>domain\dave.thomas</value>
</items>