API Usage
All customers can use POST or GET to obtain or send data to our API. In addition, any customer that chooses to use the API must add the IP address of the system attempting to access the API in the Control Panel -> Administrative -> API portion of their control panel. After adding an IP to the list of authorized hosts in your API control panel you will see the API key next to the IP address in the list. This API key is specific to this IP address and your server control panel account.
You MUST edit the privileges of the newly added IP if you want it to be able to access the API’s methods.
The base URL is:
1 |
https://one.limestonenetworks.com/webservices/clientapi.php?key=YOURAPIKEY |
An example would be:
1 |
https://one.limestonenetworks.com/webservices/clientapi.php?key=YOURAPIKEY&mod=billing&action=getbalance |
The request above from an authorized host would return your account’s current balance.
Available Methods and Actions
Module | Action | Arguments | Description |
---|---|---|---|
billing | getbalance | Get current account balance. | |
billing | history | List your billing history. | |
billing | pay | invoiceid – (int) Required sourceid – (int) Required |
Pay an invoice. |
billing | sources | List your billing sources. | |
billing | unpaid | Lists unpaid invoices. | |
dns | setreverse | ipaddress – (varchar) IP Address of record to update value – (varchar) New hostname for rDNS |
Sets the Reverse DNS entry for an IP Address assigned to you. |
servers | list | Lists your current servers and the details associated with them. | |
servers | rename | newname – (varchar) The new display name serverid – (varchar) LSN-D#### of the system. |
Renames the server’s visible designation. |
servers | restart | serverid – (varchar) LSN-D#### of the system. | Restarts the specified server. |
servers | turnoff | serverid – (varchar) LSN-D#### of the system. | Turns off the specified server. |
servers | turnon | serverid – (varchar) LSN-D#### of the system. | Turns on the specified server. |
servers | portcontrol | serverid – (varchar) LSN-D#### of the system. port – (enum) public or private set – (enum) on or off |
Turns on or off the specified server’s network port. |
servers | bwgraph | serverid – (varchar) LSN-D#### of the system. start – (int) Optional, Start time via UNIX timestamp stop – (int) Optional, Stop time via UNIX timestamp |
Returns bandwidth graph for public network in PNG format. This action is not returned in XML. |
servers | getOperatingSystems | Returns a list of operating systems to use with servers->reload | |
servers | reload | server_id – (varchar) LSN-D#### of the system. os – (int) Required password – (string) Required |
Reload a server’s operating system. Get the “os” ID from servers->getOperatingSystems |
ipaddresses | list | server_id – (varchar) Optional, LSN-D#### of the system. network – (enum) public or private. type – (enum) network, gateway, available or broadcast |
List details about your IP Addresses. Specifying the optional parameters will filter the results. |
support | addticket | probtype – (int) Required summary – (text) Required description – (text) Required user_id – (int) Required server – (varchar) Optional, LSN-D#### of the system admin_user – (text) (POST ONLY) Optional admin_pass (text) (POST ONLY) Optional |
Add a support ticket to our control panel. |
support | listtickets | status – (enum) Optional, open or closed | List your tickets. By default, all tickets are shown. |
support | getprobtypes | Returns a list of Problem Types (probtype) to send when using support->addticket. | |
support | setstatus | ticket – (int) Required Ticket ID user_id – (int) Required status – (enum) open or closed |
Set the status of a ticket. Tickets not taken by a tech cannot be closed. |
support | updateticket | ticket – (int) (Ticket ID) Required user_id – (int) Required message – (text) Required |
Update a ticket with a response. |
support | viewticket | ticket – (int) (Ticket ID) Required | |
users | list | List all of the users on your account with detail. |
Returned Data Samples
Data returned from the API is in basic XML format. The following are examples of the data returned for each of the methods and their respective actions.
Billing
The ‘getbalance’ action will return your client ID and account balance, the value expressed is USD.
1 2 3 4 5 |
<source lang="xml"> <client id="2XXX"> <balance>0.00</balance> </client> </source> |
The ‘history’ action will return a list of invoices. Each invoice includes the date of invoice, due date, short description, status, and list of payments pertaining to each invoice. A paid invoice will have an invoices->invoice->status of completed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<invoices> <invoice id="1XXX1"> <type>Debit</type> <created>2008-12-17 15:04:44</created> <unix_created>1229547884</unix_created> <duedate>0000-00-00</duedate> <unix_duedate>0</unix_duedate> <forserver>LSN-D0000</forserver> <description>New Server Order</description> <amount>136.74</amount> <status>completed</status> <payments> <payment id="1XXXX2"> <method>PayPal</method> <txnid>9SA0000000000000X</txnid> <amount>136.74</amount> </payment> </payments> </invoice> </invoices> |
Servers
The ‘list’ action will return the list of servers available in the control panel. The list includes each server’s ID, display name, public/private ips, power/port status, and bandwidth usage.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<servers> <server id="LSN-D0000"> <displayname>ServerName</displayname> <publicip>74.63.000.000</publicip> <privateip>10.2.000.000</privateip> <powerstatus>on</powerstatus> <bandwidth> <actual> <percentage>9.62</percentage> <bytes>192479575610</bytes> <friendly>192.5GB</friendly> <allocated>2000GB</allocated> </actual> <predicted> <percentage>70.87</percentage> <bytes>1417495092920</bytes> <friendly>1.4TB</friendly> </predicted> </bandwidth> <portstatus> <public>on</public> <private>on</private> </portstatus> </server> </servers> |
Code Samples
The following are some simple examples of how to query data from the API.
Simple PHP Example
The following example requires the simplexml_load_file function which is included with PHP5 but not PHP4.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
$apiKeyList = array( "exampleapikeynumber1", "exampleapikeynumber2" ) foreach ($apiKeyList as $apiKey) { $apiData = "https://one.limestonenetworks.com/webservices/clientapi.php?key=".$apiKey."&mod=servers&action=list" $serverList = simplexml_load_file($apiData) foreach ($serverList->server as $serverItem) { print "<ul>" ."<li>Server ID = {$serverItem->attributes()->id}" ."<li>Server Name = {$serverItem->displayname}" ."<li>Server Public IP = {$serverItem->publicip}" ."<li>Server Bandwidth Used = {$serverItem->bandwidth->actual->friendly}" ."</ul>" } } unset($apiKey); |