This method allows you to purchase a new number. You can provide one of the numbers that you get using numbers.get or get random number from our list.


Parameters:



  • number - integer - optional number to lease


 




 




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.lease</method>
<params>
</params>
</request>







XML Response Example


<?xml version='1.0'?>

<xml>
<method>numbers.lease</method>
<total>1</total>
<time>2012-11-08 15:51:44 GMT</time>
<timestamp>1352389904 GMT</timestamp>
<response>614000000</response>
</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->leaseNumber();

// parse response into xml object
$xml = @simplexml_load_string($methodResponse);

if($xml->response)
echo $xml->response.' number was leased';
else
echo $xml->error;
?>






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.lease?apikey=API_KEY&apisecret=API_SECRET&number=614000000