createGroup
Creates a new user group in the company hierarchy (Organization Tree). For information about how to add user groups 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, which can be either the Administrators or Technicians organizational group in the Administration Center. 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 group nodeid] | Creating a new Rescue user group with the displayed ID succeeded. |
NOTLOGGEDIN | Creating a new Rescue user group 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 Group can only be created in another Technician Group, but not in an Administrator Group. |
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 createGroup method that you can call in your environment.
HTTP GET
https://secure.logmeinrescue.com/API/createGroup.aspx?parent=337364&authcode=4ahx...80u0
HTTP POST
<form method="post" action="https://secure.logmeinrescue.com/API/createGroup.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=createGroup.
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'
);
$creategroupparams = array (
'iParentID' => 337364,
'sAuthCode' => '4ahx...80u0'
);
$loginResult = $soapclient->login($loginparams);
print_r($loginResult);
$createGroupResult = $soapclient->createGroup($creategroupparams);
$newGroup = $createGroupResult['iNewNodeID'];
print_r($createGroupResult . " New group node: " . $newGroup);
?>
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;
using createGroup.WebServiceClients;
namespace createGroup
{
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@mail.com";
string sPwd = "secretpassword";
int iParent = [ID of parent node];
int iNewNodeID;
string sAuthCode = "";
HttpWebRequest oLogin = (HttpWebRequest)WebRequest.Create(sEndpoint +
"login.aspx" + "?email=" + sEmail + "&pwd=" + sPwd);
oLogin.CookieContainer = new CookieContainer();
HttpWebResponse oLoginResp = (HttpWebResponse)oLogin.GetResponse();
string sLoginResp = new StreamReader(oLoginResp.GetResponseStream())
.ReadToEnd();
Response.Write(sLoginResp + "<br />");
CookieContainer sessioncookie = oLogin.CookieContainer;
HttpWebRequest oCreateGroup = (HttpWebRequest)WebRequest.Create(sEndpoint +
"createGroup.aspx" + "?parent=" + iParent + "&authcode=" + sAuthCode);
oCreateGroup.CookieContainer = sessioncookie;
HttpWebResponse oCreateGroupResp = (HttpWebResponse)oCreateGroup.
GetResponse();
string sCreateGroupResp = new StreamReader
(oCreateGroupResp.GetResponseStream()).ReadToEnd();
Response.Write(sCreateGroupResp);
}
catch (Exception ex)
{
lblError.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 createGroup.WebServiceClients;
namespace createGroup
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
string sEmail = "some@email.com";
string sPwd = "secretPassword";
int iParent = [ID of the parent node];
int iNewNodeID;
string sAuthCode = "";
WebServiceClients.API proxy = new WebServiceClients.API();
proxy.CookieContainer = new CookieContainer();
WebServiceClients.loginRet loginResult = proxy.login(sEmail, sPwd);
Response.Write(loginResult + "<br />");
WebServiceClients.createGroupRet cGroup = proxy.createGroup(iParent,
sAuthCode, out iNewNodeID);
Response.Write(cGroup + "<br />" + iNewNodeID);
}
catch (Exception ex)
{
lblError.Text = ex.Message;
}
}
}
}