This method is used to add a new contact list to an account.
Parameters:<?xml version='1.0'?> <request> <version>0.3</version> <key>API_KEY</key> <secret>API_SECRET</secret> <method>contact-lists.add</method> <params> <name>New List</name> </params> </request>
<?xml version='1.0'?> <xml> <method>contact-lists.add</method> <total>1</total> <time>2009-12-11 01:47:57 GMT</time> <timestamp>1260496077 GMT</timestamp> <data> <name>New List</name> <recipient_count>0</recipient_count> <id>1211</id> </data> </xml>
<?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
$name = 'My New List';
// execute request
$methodResponse = $transmitsmsAPI->addContactList($name);
// parse response into xml object
$xml = @simplexml_load_string($methodResponse);
// an error has occurred (usually this is because the list name already exists)
if (property_exists($xml, 'response') && preg_match('/^Error/', $xml->response)) {
echo "List was not added: " . (string) $xml->response;
}
else {
echo "List has been added";
}
?>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://burstsms.com.au/api-wrapper/contact-lists.add?apikey=API_KEY&apisecret=API_SECRET&name=LIST_NAME