requestLensPINCode
Generates a PIN code and sets the custom fields of newly generated Rescue Lens sessions. For information about starting a Rescue Lens session, see How to Start a Rescue Lens Session in the LogMeIn Rescue Lens User Guide.
Input Parameters
Element | Description |
---|---|
cfield0 | Custom field 0. The maximum length is 64 characters. Optional. |
cfield1 | Custom field 1. The maximum length is 512 characters. Optional. |
cfield2 | Custom field 2. The maximum length is 512 characters. Optional. |
cfield3 | Custom field 3. The maximum length is 256 characters. Optional. |
cfield4 | Custom field 4. The maximum length is 64 characters. Optional. |
cfield5 | Custom field 5. The maximum length is 64 characters. Optional. |
tracking0 | Tracking field 0. The maximum length is 64 characters. Optional. |
notechconsole | Specifies if running the Technician Console is required (0) or not (1). Optional, default is 0. |
authcode | The secret authentication code that is used to authenticate the user without logging in to Rescue. Optional. |
Output
OK PINCODE:123456
PINCODE: The 6-digit long PIN code to start a session
Return Values
Displayed Return Value | Description |
---|---|
ERROR | An unspecified error occurred, such as timeout. |
OK | Requesting a PIN code succeeded. |
NOTLOGGEDIN | Requesting a PIN code failed because the current user is no longer logged in. |
NOTTECHNICIAN | The PIN code was not requested by a technician. |
NOTECHCONSOLERUNNING | The technician is offline and the Technician Console is not running, but it is possible to request a session for an offline technician. |
OUTOFPINCODES | There are no more PIN codes that can be generated. |
POLLRATEEXCEEDED | The specified interval of requesting a new PIN code is too short. |
INVALID_SECRETAUTHCODE | The authentication code is incorrect. |
USER_IS_DELETED | The user whose authorization code was specified is already deleted. |
USER_DELETED_OR_DISABLED | The user whose authorization code was specified is already deleted or disabled. |
NO_ACCESS_TO_LENS | Requesting a PIN code failed because the current user does not have permission to access Rescue Lens. |
Sample Code
The following are examples for using the requestLensPINCode method that you can call in your environment.
HTTP GET
https://secure.logmeinrescue.com/API/requestLensPINCode.aspx?cfield0=custom1
&cfield1=custom2&cfield2=custom3&cfield3=custom3&cfield4=custom4&
cfield5=custom5&tracking0=track0¬echconsole=0&authcode=4ahx...80u0
HTTP POST
<form method="post" action="https://secure.logmeinrescue.com/API/requestLensPINCode.aspx">
<input name="cfield0" value="custom0">
<input name="cfield1" value="custom1">
<input name="cfield2" value="custom2">
<input name="cfield3" value="custom3">
<input name="cfield4" value="custom4">
<input name="cfield5" value="custom5">
<input name="tracking0" value="track0">
<input name="notechconsole" value="0">
<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=requestLensPINCode.
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
$sCField0 = "some customer";
$sCField1 = "first custom field";
$sCField2 = "second custom field";
$sCField3 = "third custom field";
$sCField4 = "fourth custom field";
$sCField5 = "fifth custom field";
$sTracking0 = $sCField0 . date("c"); //to ensure unique
//create params array for SOAP request
$requestLensPINCodeParams = array(
'sCField0' => $sCField0,
'sCField1' => $sCField1,
'sCField2' => $sCField2,
'sCField3' => $sCField3,
'sCField4' => $sCField4,
'sCField5' => $sCField5,
'sTracking0' => $sTracking0
);
$requestLensPINCodeResult = $soapclient->requestLensPINCode($requestLensPINCodeParams);
//print out the PIN Code full response
print_r("<b>requestLensPINCode full response.</b><br />");
print_r($requestLensPINCodeResult);
echo "<br /><br />"; //formatting
//show the PIN code only
$PINCode = $requestLensPINCodeResult["iPINCode"];
//print PIN Code
print_r("<b>PIN Code.</b><br />");
print_r($PINCode);
?>
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";
//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 PINCode info
HttpWebRequest oReqPINCode = (HttpWebRequest)System.Net.WebRequest.Create(sEndpoint
+ "requestLensPINCode.aspx");
oReqPINCode.CookieContainer = sessioncookie;
HttpWebResponse oRespPINCode = (HttpWebResponse)oReqPINCode.GetResponse();
string sRespPINCode = new StreamReader(oRespPINCode.GetResponseStream()).ReadToEnd();
Response.Write("requestLensPINCode result: " + sRespPINCode + "<br />"); //You can customize
the response
%>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Rescue API requestLensPINCode 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 = "";
string sCField0 = "";
string sCField1 = "";
string sCField2 = "";
string sCField3 = "";
string sCField4 = "";
string sCField5 = "";
string sTracking0 = "";
int iPIN;
WebServiceClients.loginRet oLogin = proxy.login(sEmail, sPwd);
Response.Write(oLogin + "<br />");
WebServiceClients.requestLensPINCodeRet oRequestLensPINCode = proxy.requestLensPINCode
(sCField0, sCField1, sCField2, sCField3, sCField4, sCField5, sTracking0, true, sAuthCode,
out iPIN);
Response.Write(oRequestLensPINCode + "<br />");
Response.Write("PIN code: " + iPIN);
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
}
}