We created a new viewing experience for our SMS API documentation. It's now all in one central location. Click here to check it out!

This method retrieves messages for a specific period of time.


Parameters:


  • offset - integer - used to specify where to start reading from in the data set - 0 being the first item.
  • limit - integer - used to specify maximum number of records to return. 0 disables any limit but should only be used for small data sets.
  • dateStart - integer - used to specify the starting date range - expected in Y-m-d H:i:s format (e.g 2009-12-15 17:15:00), if null is passed the date will default to 1 month ago.
  • dateEnd - integer - used to specify the ending date range - expected in Y-m-d H:i:s format (e.g 2009-12-15 17:15:00), if null is passed the date will default to today.


 




 




XML Request Example


<?xml version='1.0'?>

<request>

	<interface>PHP</interface>

	<version>0.3</version>

	<key>API_KEY</key>

	<secret>API_SECRET</secret>

	<method>message-stats.get</method>

	<params>

		<offset>0</offset>

		<limit>100</limit>

		<dateStart>2009-04-01</dateStart>

		<dateEnd>2009-12-31</dateEnd>

	</params>

</request>







XML Response Example


<?xml version='1.0'?>

<xml>

	<method>transactions.get-users</method>

	<total>2</total>

	<time>2010-01-27 04:27:06 GMT</time>

	<timestamp>1264566426 GMT</timestamp>

	<information>The dataset is limited between 2009-04-01 00:00:00 and 2009-12-31 23:59:59 - all dates are in GMT</information>	

	<dataset>

		<data>

			<caller_id>DEMO</caller_id>

			<mobile>61400000000</mobile>

			<message>

				Demo message

			</message>

			<date>2009-11-25</date>

			<time>01:00:00</time>

		</data>

		<data>

			<caller_id>DEMO</caller_id>

			<mobile>61400000000</mobile>

			<message>

				Demo message

			</message>

			<date>2009-11-25</date>

			<time>01:00:00</time>

		</data>

	</dataset>			

</xml>







PHP Example


Download the PHP API Client


<?php



// change api key and secret to your own

$myAPIKey = "API_KEY";

$myAPISecret = "API_SECRET";



// include base class

require('APIclient.php');



// create new client object

$transmitsmsAPI = new transmitsmsAPI($myAPIKey, $myAPISecret);



// set parameters

$offset = 0;

$limit = 0;

$dateStart = null;

$dateEnd = null;



// execute request

$methodResponse = $transmitsmsAPI->getMessageStats($offset, $limit, $dateStart, $dateEnd);



// parse response into xml object

$xml = @simplexml_load_string($methodResponse);



foreach ($xml->dataset->data as $message) {

	echo 'Message '.$message->message. ' was sent to ' . $message->mobile . '<br />';

}



?>






GET Example


Using a URL based request system you can request this method by using the below URL - be sure to url encode all your variables!


http://burst.transmitsms.com/api-wrapper/message-stats.get?apikey=API_KEY&apisecret=API_SECRET&offset=0&limit=10&dateStart=2010-01-01&dateEnd=2010-01-31