LogMeIn Rescue API User Guide

getAccount

Retrieves the account information of the user who is currently logged in. You can see this information in the Administration Center by hovering the mouse over a user in the organization tree.

Input Parameters

Element Description
authcode The secret authentication code that is used to authenticate the user without logging in to Rescue. Optional.

Output

OK AccountID:560961 Organization:Company AdminID:337365 TechID:337366
Email:jdoe@company.com
Element Description
AccountID Rescue account ID
Organization Name of the account holder's organization
AdminID Administrator ID of the current user
Note: If the current user is not an Administrator, AdminID contains 0.
TechID Technician ID of the current user
Note: If the current user has no technician seat (or his technician seat is disabled), TechID contains 0.
Email Email address of the account holder

Return Values

Displayed Return Value Description
ERROR An unspecified error occurred, such as timeout.
OK The properties of the currently logged-in user's account were successfully retrieved.
NOTLOGGEDIN Retrieving information failed because the user is no longer logged in.
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 getAccount method that you can call in your environment.

HTTP GET

https://secure.logmeinrescue.com/API/getAccount.aspx?authcode=4ahx...80u0

HTTP POST

<form method="post" action="https://secure.logmeinrescue.com/API/getAccount.aspx">
    <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=getAccount.

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 parameters
$loginparams = array (
'sEmail' => 'some@email.com',
'sPassword' => 'secretPassword'
);

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

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

//get account info
$accountParams = array("");
$accountResult = $soapclient->getAccount($accountParams);

//print out the hierarchy full response
print_r("<b>getAccount full response.</b><br />");
print_r($accountResult);
echo "<br /><br />";				//formatting

//show the account info
$accountID = $accountResult["iAccountID"];
$organization = $accountResult["sOrganization"];
$adminID = $accountResult["iAdminID"];
$techID = $accountResult["iTechID"];
$email = $accountResult["sEmail"];

print_r("<b>Account Information.</b>");
print_r("<table border = \"0\">");
print_r("<tr><td>" . "Account ID: </td><td>" . $accountID . "</td></tr>");
print_r("<tr><td>" . "Organization: </td><td>" . $organization . "</td></tr>");
print_r("<tr><td>" . "Admin ID: </td><td>" . $adminID . "</td></tr>");
print_r("<tr><td>" . "Tech ID: </td><td>" . $techID . "</td></tr>");
print_r("<tr><td>" . "Email: </td><td>" . $email . "</td></tr>");
print_r("</table>");

?>

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";
     //sAuthCode is the return value of the requestAuthCode API call
     string sAuthCode = "";

     //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 account info
HttpWebRequest oReqAccount = (HttpWebRequest)System.Net.WebRequest.Create(sEndpoint 
+ "getAccount.aspx?authcode=");
oReqAccount.CookieContainer = sessioncookie;

HttpWebResponse oRespAccount = (HttpWebResponse)oReqAccount.GetResponse();
string sRespAccount = new StreamReader(oRespAccount.GetResponseStream()).ReadToEnd();
Response.Write("getAccount result: " + sRespAccount + "<br />");  //You can customize 
the response 

%>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Rescue API getAccount 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.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 = "your@email.com"; //LogMeIn Rescue account email address
            string sPwd = "secretpassword"; //LogMeIn Rescue account password
            //Set up empty data for getAccount response
            int iAccount;
            string sOrg;
            int iAdmin;
            int iTech;
            string sAcctEmail;

            WebServiceClients.API proxy = new WebServiceClients.API();
            proxy.CookieContainer = new CookieContainer();
            WebServiceClients.loginRet oLogin = proxy.login(sEmail, sPwd);
            Response.Write("Login: " + oLogin + "<br />");
            WebServiceClients.getAccountRet oGetAccount = proxy.getAccount(out iAccount, 
out sOrg, out iAdmin, out iTech, out sEmail1);
            Response.Write(oGetAccount.ToString());
            Response.Write("Account ID: " + iAccount + "<br />" + "Organization ID: " 
+ sOrg + "<br />" + "Admin ID: " + iAdmin + "<br />" + "Technician ID: " + iTech + "<br />" 
+ "Email: " + sAcctEmail);
        }
    }
}