<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="../notes.xsl"?>
<Documentation>
	<Title code="0350">ReportRecentBatches</Title>
	<Overview>
		<p>Schema to enable working with recent batches of data.
			A batch is defined as a message text submitted to 2SMS at a given time and identified by a distinct 'GUID' value.
			Actual SMS messages within a batch may have been sent to a number of destinations;
			will be sent at different times if repeat message options were set;
			and in the case of a long SMS message (over 160 characters) will consist of a number of component parts.</p>
		<p>The schema provides different summary levels of information for a  batch.
			However, if the full set of results for an entire batch are required then the appropriate from of
			ReportStandard (code <a href="./0310_documentation.xml">0310</a>) should be used.</p>
	</Overview>
	<Request schema="0350_RequestReportRecentBatches.xsd">
		<p>The 'UserID' and 'Password' elements identify the account.
			The 'ServiceName' element must be set to 'ReportRecentBatches'.
			The 'SoftwareVersion' element is for internal 2SMS use only and should not be set.</p>
		<p>The 'ServiceDetail' element should contain one of the following:</p>
		<ul>
			<li>A 'RetrieveRecentGUIDs' child to obtain the most recent message reference 'GUID' values for the user.
				A 'number' attribute must also be supplied to specify the number of recent 'GUID' values to return.</li>
			<li>An empty 'RetrieveRecentBatches' child to obtain basic details of all recent 'batches' sent both this month and last.</li>
			<li>A 'RetrieveSpecificBatch' child element to obtain detailed information on a specific batch.
				This element must in turn contain
				<ul>
					<li>A 'GUID' element (the original GUID reference of the batch).</li>
					<li>A 'DateID' element (an integer timestamp based on when the initial message request was received).</li>
				</ul>
				whose content together define the message batch.
				These values will have been obtained either by calling this method with the empty 'RetrieveRecentBatches' element,
				or extracted from a response to a SendMessage request (code <a href="./0410_documentation.xml">0410</a>).
			</li>
		</ul>
		<p>It may also contain an optional 'useUTC' attribute if date output is required in coordinated universal time.</p>
	</Request>
	<Response schema="0350_ResponseReportRecentBatches.xsd">
		<p>This method returns a successful "00/OK" response if the batch details were successfully retrieved.
			The 'Result' element contains the number of 'Record' elements.</p>
		<p>The information in the 'Detail' element depends on the 'ServiceDetail' child of the initial request:</p>
		<ul>
			<li>A 'RetrieveRecentGUIDs' request returns a <b><i>set</i></b> of 'Record' elements each with a single 'GUID' child
				element containing one of the most recently used GUID values.</li>
			<li>A 'RetrieveRecentBatches' request returns a <b><i>set</i></b> of 'Record' elements with the following children:
				<ul>
					<li>A 'Batch' element with child elements containing the 'GUID' and 'DateID' values of the batch.</li>
					<li>A 'Message' element containing the text for the batch.
						For long SMS messages (i.e. over 160 characters) the text is reconstituted from its component parts.</li>
				</ul></li>
			<li>A 'RetrieveSpecificBatch' request returns a <b><i>single</i></b> 'Record' element with the following children:
				<ul>
					<li>A 'Batch' element with child elements containing the 'GUID' and 'DateID' values of the batch.</li>
					<li>A 'Message' element containing the text for the batch.
						For long SMS messages (i.e. over 160 characters) the text is reconstituted from its component parts.</li>
					<li>A 'Destinations' element with a set of 'Destination' children to identify where the batch was sent.</li>
					<li>A 'DateSent' element which contains the time the message was submitted to 2SMS in ISO-8601 format.
						This is in coordinated universal time if the useUTC attribute was set,
						otherwise it is in the time zone registered for the account.</li>
					<li>A 'Status' element whose children have 'Count' attributes that detail the numbers of messages with a given status
						(e.g. Success, Failed or WithNetwork).</li>
				</ul></li>
		</ul>
	</Response>
</Documentation>