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 is used to return your contact lists.


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>

	<version>0.3</version>

	<key>API_KEY</key>

	<secret>API_SECRET</secret>

	<method>contact-lists.get</method>

	<params>

		<offset>0</offset>

		<limit>10</limit>

	</params>

</request>







XML Response Example


<?xml version='1.0'?>

<xml>

	<method>contact-lists.get</method>

	<total>1</total>

	<time>2009-12-11 02:47:22 GMT</time>

	<timestamp>1260499642 GMT</timestamp>

	<dataset>

		<data>

			<id>1</id>

			<name>My SMS List</name>

			<recipient_count>3</recipient_count>

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



// execute request

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



// parse response into xml object

$xml = @simplexml_load_string($methodResponse);



// problem with request 

if (! $xml) { 

	exit(date("y-m-d H:i:s") . " - Problem with request : " . $methodResponse);

}



// valid response has come back

else {

	

	// view contents of the request in raw dump form

	echo "<pre>";

	print_r($xml);

	echo "</pre>";



	/******************************************************************************************	

	Following examples assume use of the SimpleXML object examples	

	SimpleXML returns objects so type casting has been used to avoid any type related issues. 

	******************************************************************************************/

	

	// display method

	echo (string) $xml->method . '<br />';



	// access id of first dataset child

	echo (string) $xml->dataset[0]->data->id . '<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/contact-lists.get?apikey=API_KEY&apisecret=API_SECRET&offset=0&limit=10