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 get a numbers you can purchase. Please note it returns only numbers from your country.


Parameters:


This method doesn't require any parameters


 




 




XML Request Example


<?xml version='1.0'?>

<request>

	<interface>PHP</interface>

	<version>0.4</version>

	<key>API_KEY</key>

	<secret>API_SECRET</secret>

	<method>numbers.get-available</method>

	<params>

	</params>

</request>







XML Response Example


<xml>

<method>numbers.get</method>

<total>3</total>

<time>2012-11-08 15:35:23 GMT</time>

<timestamp>1352388923 GMT</timestamp>

<dataset>

	<data>

		<longcode>6140000000</longcode>

	</data>

	<data>

		<longcode>6140000001</longcode>

	</data>

	<data>

		<longcode>6140000002</longcode>

	</data>

</dataset>

</xml>







PHP Example


<?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);



// execute request

$methodResponse = $transmitsmsAPI->getAvailableNumbers();



// parse response into xml object

$xml = @simplexml_load_string($methodResponse);



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

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

	echo 'Number ' . (string) $number->longcode;

}



?>






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/numbers.get-available?apikey=API_KEY&apisecret=API_SECRET