LogMeIn Rescue API User Guide

getSession

Retrieves the current sessions of any hierarchy node (technician or channel). You can see the list of sessions on the Sessions tab of the Rescue Administration Center.

Input Parameters

Element Description
node The sessions of this node are listed. This is an optional element. If the ID of a node i not specified, it returns all existing sessions for all technicians and channels. Required.
noderef The reference of the node, which can be NODE or CHANNEL. Optional, default is NODE.
authcode The secret authentication code that is used to authenticate the user without logging in to Rescue. Optional.

Output

OK ID|Status|Entry ID|Entry|Technician ID|Technician|Start Time|Waiting Time|Custom Field 0|
Custom Field 1|Custom Field 2|Language|Transferred To|Transferred Comment|Is Lead Technician|
HandingOff|1663112|Waiting|0||337366|John Doe|2/16/2012 9:00 AM|13|Customer|||en|||yes|| 

The list that the getSession method retrieves contains information about a session in a table. This table has the following columns:

  • ID: Session ID
  • Status: Session status
    Possible values:
    • Aborted: technician was deleted or disabled
    • Active
    • Closed by active customer
    • Closed by customer
    • Closed by technician
    • Closed by waiting customer
    • Connecting
    • Disconnected
    • Not available
    • Offline
    • On Hold
    • Rebooted
    • Rebooting
    • Reconnecting
    • Timed out
    • Timed out: closed by technician
    • Transferred
    • Transferring
    • Waiting
  • Entry ID: Channel's ID
  • Entry: Channel's name
  • Technician ID: Technician's ID
  • Technician: Technician's name
  • Start Time: Start time of the session
  • Waiting Time: Time elapsed since the last session status change
  • Custom Field 0-2: Custom fields that the Technician fills in when he initiates a session
  • Language: The two-digit language code of the customer's operation system
  • Transferred To: The recipient Technician of a transferred session
  • Transferred Comment: Comment to the recipient Technician when a session transferred
  • Is Lead Technician: Denotes whether the technician of the session is the lead technician
  • HandingOff: Denotes whether the session was handed over to the technician

Session List Elements

The table containing the session list has the following elements:

Session list element Content
<sessions> <session_header> <session_rows>
<session_header> <field_value> <delimiter> <session_header> | <field_value> <new_line_char>
<session_rows> <session_row> <session_row> | <session_row>
<session_row> <field_value> <delimiter> <session_row> | <field_value> <new_line_char>
<field_value> <char> <field_value> | <char>
<char> [.]
<new_line_char> '\n'

Return Values

Displayed Return Value Description
ERROR An unspecified error occurred, such as timeout.
OK Retrieving session information succeeded.
NOTLOGGEDIN Retrieving session information failed because the current is no longer logged in.
INVALIDPARAM_NODE The specified ID is not the ID of an existing node.
INVALID_SECRETAUTHCODE The secret authentication code for the user is invalid.
USER_DELETED_OR_DISABLED The user is deleted or disabled.

Sample Code

The following are examples for using the getSession method that you can call in your environment.

HTTP GET

https://secure.logmeinrescue.com/API/getSession.aspx?node=337366&noderef=NODE
&authcode=4ahx...80u0

HTTP POST

<form method="post" action="https://secure.logmeinrescue.com/API/getSession.aspx">
        <input name="node" value=337366>
        <input name="noderef" value=NODE>
        <input name=authcode value=4ahx...80u0>
</form>

SOAP

For sample SOAP 1.1 and SOAP 1.2 request and response messages, visit https://secure.logmeinrescue.com/api/API.asmx?op=getSession.

PHP with SOAP

The example values shown must be replaced with actual values.

<?php
$soapclient = new SoapClient("https://secure.logmeinrescue.com/api/api.asmx?wsdl");

//define variables
$sEmail = "someEmail@domain.com";
$sPassword = "secretPassword";
$iNodeID = "337366";    //define this with your own data
$eNodeRef = "NODE";    //define this appropriately based on your data
$sAuthCode = "4ahx...80u0";

//define parameters
$loginparams = array (
'sEmail' => $sEmail,
'sPassword' => $sPassword);

//login
$loginResult = $soapclient->login($loginparams);

//print the result
echo "<b>Login full response.</b><br />";		//formatting
print_r($loginResult);
echo "<br /><br />";					//formatting

//switch to XML for easier formatting of output
$output = array(
'eOutput' => "XML"
);

$outputResponse = $soapclient->setOutput($output);
print_r("<b>setOutput Full response.</b> <br />");
print_r($outputResponse);
echo "<br /><br />";					//formatting


//set up array for getSession
$sessionparams = array(
'iNodeID' => $iNodeID,
'eNodeRef' => $eNodeRef,
'sAuthCode' => $sAuthCode
);

//get session(s)
$sessionresult = $soapclient->getSession($sessionparams);

//show the full getSession response
print_r("<b>getSession Text full response.</b><br />");
print_r($sessionresult);

?>

C# with HttpWebRequest

The example values shown must be replaced with actual values.

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <% 
     string sEndpoint = "https://secure.logmeinrescue.com/API/";  //add actionName.aspx? 
for each action called
     string sEmail = "some@email.com";
     string sPwd = "secretPassword";
     string sAuthCode = "4ahx...80u0";

     //set up the request
     HttpWebRequest oReq = (HttpWebRequest)System.Net.WebRequest.Create(sEndpoint
 + "login.aspx" + "?email=" + sEmail + "&pwd=" + sPwd);
    
     //create a cookie container to store the cookies for this session 
     oReq.CookieContainer = new CookieContainer();
     
     
     //get the response
     HttpWebResponse oResp = (HttpWebResponse)oReq.GetResponse();

string sResp = new StreamReader(oResp.GetResponseStream()).ReadToEnd();
Response.Write("Login result: " + sResp + "<br />");  //You can customize the response

/*
//debug cookies
foreach (Cookie cook in oResp.Cookies)
{
Response.Write("Cookie:" + "<br />");
Response.Write("Name: " + cook.Name + " " + "Value: " + cook.Value + "<br />");
Response.Write("Domain: " + cook.Domain + "<br />");
Response.Write("Path: " + cook.Path + "<br />");
Response.Write("Port: " + cook.Port + "<br />");
Response.Write("Secure: " + cook.Secure + "<br />");

Response.Write("When issued: " + cook.TimeStamp + "<br />");
Response.Write("Expires: " + cook.Expires + " " + "Expired? " + cook.Expired + "<br />");
Response.Write("Don't save: " + cook.Discard + "<br />");
Response.Write("Comment: " + cook.Comment + "<br />");
Response.Write("Uri for comments: " + cook.CommentUri + "<br />");
Response.Write("Version: RFC " + cook.Version + "<br />");
    
// Show the string representation of the cookie.
Response.Write("String: " + cook.ToString());
}*/
     
//add cookies to cookie container
CookieContainer sessioncookie = oReq.CookieContainer;

//get the Session info
//remember to tag your intended node to the URL
int iNode = "";
string eNodeRef = "NODE";


HttpWebRequest oReqSession = (HttpWebRequest)System.Net.WebRequest.Create(sEndpoint
 + "getSession.aspx?node=" + sNode + "&noderef=" + eNodeRef + "&authcode=" + sAuthCode);
oReqSession.CookieContainer = sessioncookie;

HttpWebResponse oRespSession = (HttpWebResponse)oReqSession.GetResponse();
string sRespSession = new StreamReader(oRespSession.GetResponseStream()).ReadToEnd();
Response.Write("getSession result: " + sRespSession + "<br />");  //You can customize 
the response

%>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Rescue API getSession Test</title>
</head>
<body>

</body>
</html>

C# with SOAP

The example values shown must be replaced with actual values.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using apiSamples.WebServiceClients;

namespace apiSamples
{
    public partial class SOAP : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                WebServiceClients.API proxy = new WebServiceClients.API();
                proxy.CookieContainer = new CookieContainer();

                string sEmail = "some@email.com";
                string sPwd = "secretPassword";
                string sAuthCode = "4ahx...80u0";
                int iNodeID = 337366;
                NODE_REF eNodeRef = NODE_REF.NODE;
                SESSION[] aSessions;

                WebServiceClients.loginRet oLogin = proxy.login(sEmail, sPwd);
                Response.Write(oLogin + "<br />");

                WebServiceClients.getSessionRet oGetSession = proxy.getSession(iNodeID,
 eNodeRef, sAuthCode, out aSessions);
                Response.Write(oGetSession + "<br />");

                foreach(SESSION s in aSessions)
                {
                    Response.Write("Session ID: " + s.iID + " Technician: " + s.sTechnician);
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
    }
}