LogMeIn Rescue API User Guide

createUser

Creates a new user node (technician, administrator, or master administrator) in the company hierarchy (Organization Tree). For information about how to add users in the Rescue Administration Center, see Setting up Your Organization in the LogMeIn Rescue Administration Center User Guide.

Input Parameters

Element Description
parent The ID of the parent node that must be Master Administrator, Administrator, or Technician Group. 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 [new person nodeid] Creating a new Rescue user with the displayed ID succeeded.
NOTLOGGEDIN Creating a new Rescue user failed because the current user is no longer logged in.
INVALIDPARAM_PARENT The ID of the parent group is incorrect either because it does not exist or because it is an incorrect group type. For example, a technician can only be created in a Technician Group, but not in a channel.
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 createUser method that you can call in your environment.

HTTP GET

https://secure.logmeinrescue.com/API/createUser.aspx?parent=337364&authcode=4ahx...80u0

HTTP POST

<form method="post" action="https://secure.logmeinrescue.com/API/createUser.aspx">
        <input name="parent" value="337364">
        <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=createUser.

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'
	);

	$createuserparams = array (
		'iParentID' => 337364,
		'sAuthCode' => ''
	);

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

	print_r($loginResult);

	$createUserResult = $soapclient->createUser($createuserparams);
	
	$newUser = $createUserResult['iNewNodeID'];
	
	print_r($createUserResult . " New user node: " . $newUser);
?>

C# with HttpWebRequest

The example values shown must be replaced with actual values.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.IO;

namespace createUser
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string sEndpoint = "https://secure.logmeinrescue.com/api/";
                string sEmail = "[some@email.com";
                string sPwd = "secretpassword";
                string sAuthCode = "";

                //Authenticate Rescue credentials
                HttpWebRequest oReq =
                    (HttpWebRequest)WebRequest.Create(sEndpoint + "login.aspx" + "?email=" 
+ sEmail + "&pwd=" + sPwd);

                //Create session cookie to carry login credentials
                oReq.CookieContainer = new CookieContainer();
                
                //Get response
                HttpWebResponse oResp = (HttpWebResponse)oReq.GetResponse();

                string sResp = new StreamReader(oResp.GetResponseStream()).ReadToEnd();
                Response.Write(sResp + "<br />");

                //Add cookie to CookieContainer
                CookieContainer sessioncookie = oReq.CookieContainer;

                //Define ID of parent node
                string pNode = [ID of parent node];

                //Create user
                HttpWebRequest oReq1 =
                    (HttpWebRequest)WebRequest.Create(sEndpoint + "createUser.aspx"
 + "?parent=" + pNode + "&authcode=" sAuthCode);
                oReq1.CookieContainer = sessioncookie;

                HttpWebResponse oResp1 = (HttpWebResponse)oReq1.GetResponse();

                string sResp1 = new System.IO.StreamReader(oResp1.GetResponseStream())
.ReadToEnd();
                Response.Write(sResp1 + "<br />");
            }
            catch (Exception ex)
            {
                defaultError.Text = ex.Message;
            }
        }
    }
}

C# with SOAP

The example values shown must be replaced with actual values.

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

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

                string sEmail = "some@email.com";
                string sPwd = "secretPassword";
                string sAuthCode = "";

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

                int iParentID = [ID of parent node];
                int iNewNodeID;

                //Create user
                WebServiceClients.createUserRet createResult = proxy.createUser(iParentID, 
sAuthCode, out iNewNodeID);
                Response.Write(iNewNodeID);
                }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
    }
}