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 returns your message activity (the same data as available on the overview screen).


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.


 




 




XML Request Example


<?xml version='1.0'?>

<request>

	<interface>PHP</interface>

	<version>0.3</version>

	<key>API_KEY</key>

	<secret>API_SECRET</secret>

	<method>messages.get</method>

	<params>

		<offset>0</offset>

		<limit>4</limit>

	</params>

</request>







XML Response Example


<?xml version='1.0'?>

<xml>

	<method>messages.get</method>

	<total>67</total>

	<time>2009-12-21 23:08:45 GMT</time>

	<timestamp>1261436925 GMT</timestamp>

	<dataset>

		<data>

			<id>28153</id>

			<list_id>175</list_id>

			<mobile_from>61406614352</mobile_from>

			<message>go go gadget goer</message>

			<datetime_send>2009-12-21 23:00:43</datetime_send>

			<datetime_actioned>2009-12-21 22:58:50</datetime_actioned>

			<recipient_count>1</recipient_count>

			<status>completed</status>

			<schedule>No</schedule>

		</data>

		<data>

			<id>28152</id>

			<list_id>175</list_id>

			<mobile_from>61406614352</mobile_from>

			<message>hey me</message>

			<datetime_send>2009-12-21 22:50:29</datetime_send>

			<datetime_actioned>0000-00-00 00:00:00</datetime_actioned>

			<recipient_count>0</recipient_count>

			<status>active</status>

			<schedule>No</schedule>

		</data>

		<data>

			<id>28109</id>

			<list_id>0</list_id>

			<mobile_from>61406614352</mobile_from>

			<message>Haircut reminder</message>

			<datetime_send>2009-12-16 02:55:00</datetime_send>

			<datetime_actioned>2009-12-16 02:55:01</datetime_actioned>

			<recipient_count>1</recipient_count>

			<status>completed</status>

			<schedule>Yes</schedule>

		</data>

		<data>

			<id>28104</id>

			<list_id>175</list_id>

			<mobile_from>REPLY-NUMBER</mobile_from>

			<message>Hi me, [opt-out-info]</message>

			<datetime_send>2009-12-14 22:20:15</datetime_send>

			<datetime_actioned>2009-12-14 22:18:20</datetime_actioned>

			<recipient_count>1</recipient_count>

			<status>completed</status>

			<schedule>No</schedule>

		</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 = 4;



// execute request

$methodResponse = $transmitsmsAPI->getMessages($offset, $limit);



// parse response into xml object

$xml = @simplexml_load_string($methodResponse);



echo 'There are ' . $xml->total . ' messages<hr />';

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

	echo 'Message ' . (string) $message->id . ' is ' . (string) $message->status . '<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/messages.get?apikey=API_KEY&apisecret=API_SECRET&offset=0&limit=10