LogMeIn Rescue API User Guide

setReportDate_v2

Sets the start and end date and, optionally, time of your report period. You can set the report date range in the Reports tab of the Rescue Administration Center. For information on reports, see Generating Reports in the LogMeIn Rescue Administration Center User Guide.

Note: Both setReportTime and setReportDate_v2 can set the time of your report period. The difference is that setReportDate_v2 sets the start and end time of your whole report period, whereas setReportTime sets a daily time range for every day of your report period. For example, you can define a report period between 12/1/2011 0:00:00 and 5/31/2012 23:59:59 with the setReportDate_v2 method. Then restrict reporting every day from 9:00 to 17:00 with the setReportTime method.

Changes in Version 2 of setReportDate

The following has been updated in the setReportDate_v2 method:

  • The data type of the output parameters has been changed from string to dateTime.
  • It is possible to define the start and end time of the reporting period with the bdate and edate input parameters.

Input Parameters

Element Description
bdate The start date of the report in M/D/YYYY format. Required. Additionally, you can optionally define the start time of the report in M/D/YYYY H:MM:SS format.
edate The end date of the report in M/D/YYYY format. Required. Additionally, you can optionally define the start time of the report in M/D/YYYY H:MM:SS format.
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 Setting the start and end dates of the report succeeded.
NOTLOGGEDIN Setting the start and end dates of the report failed because the current user is no longer logged in.
INVALIDFORMAT The date format is invalid.
INVALIDDATERANGE The end date is earlier than the start date of the report.
INVALID_SECRETAUTHCODE The authentication code is invalid.
USER_DELETED_OR_DISABLED The user whose authentication code is provided is already deleted or disabled.

Sample Code

The following are examples for using the setReportDate_v2 method that you can call in your environment.

HTTP GET

https://secure.logmeinrescue.com/API/setReportDate_v2.aspx?bdate=12/1/2011 8:00:00
&edate=12/31/2011 19:59:59&authcode=4ahx...80u0

HTTP POST

<form method="post" action="https://secure.logmeinrescue.com/API/setReportDate_v2.aspx">
        <input name="bdate" value="12/1/2011 8:00:00">
        <input name="edate" value="12/31/2011 19:59:59">
        <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=setReportDate_v2.

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

$sAuthCode = "";

//define parameters
$dBeginDate = new DateTime('01/13/2015 08:00:00');
$dEndDate = new DateTime('01/16/2015 07:59:59');

$reportdateparams = array (
'dBeginDate' => $dBeginDate->format('c'),
'dEndDate' => $dEndDate->format('c'),
'sAuthCode' => $sAuthCode
);

//set the report date
$setReportDateResult = $soapclient->setReportDate_v2($reportdateparams);

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

?>

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";
     string sAuthCode = "4ahx...80u0";

     //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 ReportDate info
DateTime dBDate = new DateTime(2011, 12, 1, 8, 0, 0);
DateTime dEDate = new DateTime(2011, 12, 31, 19, 59, 59);
HttpWebRequest oReqReportDate = (HttpWebRequest)System.Net.WebRequest.Create(sEndpoint
 + "setReportDate_v2.aspx?bdate=" + dBDate + "&edate=" + dEDate + "&authcode=" + sAuthCode);
oReqReportDate.CookieContainer = sessioncookie;

HttpWebResponse oRespReportDate = (HttpWebResponse)oReqReportDate.GetResponse();
string sRespReportDate = new StreamReader(oRespReportDate.GetResponseStream()).ReadToEnd();
Response.Write("setReportDate result: " + sRespReportDate + "<br />");  //You can 
customize the response

%>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Rescue API setReportDate 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 = "4ahx...80u0";
                DateTime dBeginDate = new DateTime(2011, 12, 1, 8, 0, 0);
                DateTime dEndDate = new DateTime(2011, 12, 31, 19, 59, 59);

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

                WebServiceClients.setReportDateRet oSetDate = proxy.setReportDate_v2
(dBeginDate, dEndDate, sAuthCode);
                Response.Write(oSetDate);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
    }
}