closeSession
An administrator can close a technician session. You can close a session from the Sessions tab of the Rescue Administration Center.
Input Parameters
Element | Description |
---|---|
session | The ID of the target session. Required. |
authcode | The secret authentication code that is used to authenticate the user without logging in to Rescue. Optional. |
Return Values
Displayed Return Value | Description |
---|---|
ERROR | An unspecified error occurred, such as timeout. |
OK | Closing the session succeeded. |
NOTLOGGEDINASADMIN | Closing the session failed because the administrator is not logged in. |
ACTIONFAILED | Closing a session failed because the technician is offline and the Technician Console is not running. |
INVALIDPARAM_SESSION | The ID of the session is incorrect. |
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 closeSession method that you can call in your environment.
HTTP GET
https://secure.logmeinrescue.com/API/closeSession.aspx?session=12345678
&authcode=4ahx...80u0
HTTP POST
<form method="post" action="https://secure.logmeinrescue.com/API/closeSession.aspx">
<input name="session" value="12345678">
<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=closeSession.
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");
$loginparams = array (
'sEmail' => 'some@email.com',
'sPassword' => 'secretPassword'
);
$cancelactionparams = array (
'iSession' => 12345678,
'sAuthCode' => '4ahx...80u0'
);
$loginResult = $soapclient->login($loginparams);
print_r($loginResult);
$closeSessionResult = $soapclient->closeSession($closesessionparams);
print_r($closeSessionResult);
?>
C# with HttpWebRequest
The example values shown must be replaced with actual values.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace APIexamples
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string sEndpoint = "https://secure.logmeinrescue.com/api/";
string sEmail = "some@email.com"; //LogMeIn Rescue account email address
string sPwd = "secretPassword"; //LogMeIn Rescue account password
int iSession = 12345678; //Session ID goes here
string sAuthCode = "4ahx...80u0";
//Login
HttpWebRequest oLogin = (HttpWebRequest)WebRequest.Create(sEndpoint
+ "login.aspx?email=" + sEmail + "&pwd=" + sPwd);
oLogin.CookieContainer = new CookieContainer();
//Get login response
HttpWebResponse oLoginResp = (HttpWebResponse)oLogin.GetResponse();
string sLoginResp = new StreamReader(oLoginResp.GetResponseStream()).ReadToEnd();
Response.Write("Login status: " + sLoginResp + "<br />");
//Add session cookie to CookieContainer to persist login
CookieContainer sessioncookie = oLogin.CookieContainer;
//Close the session
HttpWebRequest oCloseSession = (HttpWebRequest)WebRequest.Create(sEndpoint
+ "closeSession.aspx?session=" + iSession + "&authcode=" + sAuthCode);
oCloseSession.CookieContainer = sessioncookie;
//Get closeSession response
HttpWebResponse oCloseSessionResp = (HttpWebResponse)oCloseSession.GetResponse();
string sCloseSessionResp = new StreamReader(oCloseSessionResp.
GetResponseStream()).ReadToEnd();
Response.Write("Session: " + sCloseSessionResp);
}
}
}
C# with SOAP
The example values shown must be replaced with actual values.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using APIexamples.WebServiceClients;
namespace APIexamples
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string sEmail = "some@email.com"; //LogMeIn Rescue account email address
string sPwd = "secretPassword"; //LogMeIn Rescue account password
int iSession = 12345678; //ID of session to close
string sAuthCode = "4ahx...80u0";
WebServiceClients.API proxy = new WebServiceClients.API();
proxy.CookieContainer = new CookieContainer();
//Login
WebServiceClients.loginRet oLogin = proxy.login(sEmail, sPwd);
Response.Write(oLogin.ToString() + "<br />"); //You can customize the response
//Close session
WebServiceClients.closeSessionRet oCloseSession = proxy.closeSession(iSession,
sAuthCode);
Response.Write(oCloseSession.ToString()); //You can customize the response
}
}
}