<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="../notes.xsl"?>
<Documentation>
	<Title code="0340">ReportOverview</Title>
	<Overview>
		<p>Schema used to return a message overview report which aggregates messages by either message status, destination or time.</p>
	</Overview>
	<Request schema="0340_RequestReportOverview.xsd">
		<p>The 'UserID' and 'Password' elements identify the account.
			The 'ServiceName' element must be set to 'ReportOverview'.
			The 'SoftwareVersion' element is for internal 2SMS use only and should not be set.</p>
		<p>The 'ServiceDetail' element should contain a set of children starting with a 'DateRange' element.
			This should contain one of the following to determine the time period for the report:</p>
		<ul>
			<li>With 'StartDate' and 'EndDate' children it returns a report for an explicitly specified time-period (up to 31 days).
				The DateTime information must be supplied in one of these ISO-8601 formats:
				<ul>
					<li>yyyy-MM-dd'T'HH:mm:ss.SSS in the time-zone registered with the account.</li>
					<li>yyyy-MM-dd'T'HH:mm:ss.SSS'Z' in coordinated universal time (the 'useUTC' attribute must be set to true).</li>
				</ul></li>
			<li>With a 'RelativeName' child it runs a report for a relative time period described by one of the enumerated values:
				'Today'; 'Yesterday'; 'This Month'; or 'Last Month'.
				This is evaluated with respect to the time-zone registered with the account.</li>
			<li>With a 'RecentDays' child it runs a report for the specified period of days (up to 14)
				in the time-zone registered with the account.
				E.g. a value of two would cover the time period from the start of the previous day until the current time.</li>
		</ul>
		<p>The 'RelativeName' and 'RecentDays' elements may be followed by a 'SavedReport' element
			(not available with 'SubAccount' element).
			This stores the report generating information for use with code <a href="./0360_documentation.xml"> 0360</a> requests.
			The 'SavedReport' element must contain the following children:</p>
			<ul>
				<li>A 'Name' element containing the name to identify the report in future.</li>
				<li>A 'Format' element containing any additional information useful to the client application (e.g. format for results).</li>
			</ul>
		<p>The following additional XML nodes may also be supplied:</p>
		<ul>
			<li>An optional 'useUTC' attribute set to true if date input and output is to be in coordinated universal time.</li>
			<li>An optional 'Status' element to filter results with a specific delivery status (e.g. Success, WithNetwork or Failed).</li>
			<li>An optional 'Destination' element to filter results sent to a specific destination (not available with 'SubAccount' element).</li>
			<li>An optional 'GUID' element to filter results with a specific GUID reference value (not available with 'SubAccount' element).</li>
			<li>An optional 'SubAccount' element containing the UserID of one of the user's sub-accounts.
				The overview provided will then cover the specified sub-account rather than the user's own.
				For data protection reasons this option is not available with the 'Destination' and 'GUID' elements.
				It is also not currently possible to save a report with the 'SubAccount' element.</li>
			<li>A 'GroupBy' element to determine the response output.</li>
		</ul>
	</Request>
	<Response schema="0340_ResponseReportOverview.xsd">
		<p>This method returns a successful "00/OK" response if the report is successfully retrieved.
			The 'Result' element contains the number of 'Record' elements.
			The 'Detail' element contains:</p>
		<ul>
			<li>A 'ReportTitle' element which describes the report.</li>
			<li>A 'DateRange' element whose 'StartDate' and 'EndDate' children confirm the range of the report (format dependent on 'useUTC' attribute).</li>
			<li>A set of 'Record' elements each with a single child element whose 'Count' attribute reports the number
				of messages relating to its text content.
				The name and interpretation of these elements depends on the request's 'GroupBy' content:
				<ul>
					<li>When grouping by 'Status' the child is named 'Status' and holds a message status (e.g. Success, Failed, WithNetwork).</li>
					<li>When grouping by 'Destination' the child is named 'Destination' and holds an email or SMS destination.</li>
					<li>When grouping by 'Day' the child is named 'Day' and has text containing the day being reported on
						(format is ISO-8601 date only format i.e. yyyy-MM-dd).
						Start and end of the day are always taken to be in the authenticated account's time-zone ('useUTC' attribute notwithstanding).</li>
					<li>When grouping by 'Month' the child is named 'MonthBeginning' and has text containing
						the first day of the month being reported on (format is ISO-8601 date only format i.e. yyyy-MM-dd).
						Start and end of the month are always taken to be in the authenticated account's time-zone ('useUTC' attribute notwithstanding).</li>
				</ul></li>
		</ul>
	</Response>
</Documentation>