PHP

Introduction

					

Getting Started

To access the Tera API, an API key will need to be established. Use the following steps to create an API key for your account:

  1. Login to Tera at https://cp.100tb.com
  2. Open the API Manager by selecting Tools > API.
  3. Select Add Key, provide a description for the key, and click OK.

An API Key will be generated, which will be required to access the Tera API Server. For information regarding the basic usage of the API, take a look at our API Basics section. You may also use the API Explorer as a resource to view all available Tera API operations.

Using the API Explorer

The API Explorer can be used to discover all of the available resources within the Tera API.

To use the API Explorer, an API Key needs to be provided in the api_key textfield at the top-left of the page, If an API Key is not provided, a 400: Missing Authentication error will be returned. By clicking one of the available resources, you can view the operations and appropriate HTTP methods included with that resource. Provide any of the required parameters for a specific operation, then click the Try it out! button to send the request. A response will show, including the following data:

  • Request URL
  • Response Code + Headers
  • Response Body

In most cases, API requests will return encoded JSON (JavaScript Object Notation) data. However there are some API requests that will return raw data, such as PNG image data for the bandwidth graph operations, or raw html formatted invoice. These special cases will be noted in the Implementation notes for that specific resource operation.

						
                        
					

API Basics

API requests can be made by using curl or any programming language that supports HTTP requests. All requests should be made to the following endpoint: https://cp.100tb.com/rest-api/

Authentication

Every request URL will require the api_key parameter. If the api_key parameter is not provided, then a 400: Missing Authentication error will be returned.

Examples

Every method request will be accompanied by an example block of code to the right of the method call. If you look to the right side pane you will see an example call using get and curl. However each method call will be formatted in PHP with the use of Tera's PHP API Client.

						
#How to use cURL via PHP
#GET request via PHP


$request_url = "https://cp.100tb.com/rest-api/servers.json?api_key=PLACE_KEY_HERE";

$ch = curl_init($request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = array(
'response_body' => curl_exec($ch),
'info' => curl_getinfo($ch),
);

curl_close($ch);
print_r($result);
                        
					

API Client

100TB has invested resources into providing clients with a powerful and yet simple to use PHP API Client. Similar to the API Explorer, the PHP API client requires the use of an api_key.
(Follow the steps outlined here to obtain your key now)

By utilizing the PHP API client, you can simply copy and paste all the example code provided for each method call. If you wish to utilize it, you may do so by downloading it from here: Download

						
                        
					

Billing

					

Get Invoices

GET /billing/invoices.json

Implementation Notes
Get list of invoices
Parameters
Name Type Required Description
start integer No Start date (UNIX timestamp). Required if custom date range is needed, otherwise optional.
end integer No End date (UNIX timestamp). If not provided, will use today as end date.
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'start' => 'integer',
		'end' => 'integer'
);

try {
    $response = $teraClient->get('/billing/invoices.json',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'id':2004321,'generated':'2015-01-29','due':'2015-01-31','amount':47.50,'status':'Unpaid'}]

Get Raw Invoice

GET /billing/invoices.json/{invoice}

Implementation Notes
Get details for an invoice (Returns raw HTML formatted invoice)
Parameters
Name Type Required Description
invoice integer Yes Invoice ID.
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'invoice' => 'integer'
);

try {
    $response = $teraClient->get('/billing/invoices.json/{invoice}',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

Get Services

GET /billing/services.json

Implementation Notes
Get list of services
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    //empty
);

try {
    $response = $teraClient->get('/billing/services.json',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'id':12345,'description':'My first server','start_date':'01-01-2015','price':130.00,'addons':[{'id':54321,'description':'R1Soft Agent','start_date':'01-07-2015','price':8.00}]}]

Get Service by ID

GET /billing/services.json/{service}

Implementation Notes
Get details for a service
Parameters
Name Type Required Description
service integer Yes Service ID.
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'service' => 'integer'
);

try {
    $response = $teraClient->get('/billing/services.json/{service}',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

{'id':12345,'description':'My first server','start_date':'01-01-2015','price':130.00,'addons':[{'id':54321,'description':'R1Soft Agent','start_date':'01-07-2015','price':8.00}]}

DNS

					

Get DNS Zones

GET /dns.json

Implementation Notes
Get all DNS zones
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    //empty
);

try {
    $response = $teraClient->get('/dns.json',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'id': '1234567','name': 'supercool.info'},{'id': '2345678','name': 'anothergreat.com'}]

Get DNS Zone

GET /dns.json/{zone}

Implementation Notes
Get DNS zone information
Parameters
Name Type Required Description
zone integer Yes DNS Zone ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'zone' => 'integer'
);

try {
    $response = $teraClient->get('/dns.json/{zone}',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'data':'dns1.testdomain123.com.','domainId':123456,'expire':1728000,'host':'@','id':64628062,'minimum':43200,'mxPriority':null,'refresh':7200,'responsiblePerson':'root.testdomain123.com.','retry':600,'ttl':86400,'type':'soa'},{'data':'127.0.0.1','domainId':123456,'expire':null,'host':'@','id':64628061,'minimum':null,'mxPriority':null,'refresh':null,'retry':null,'ttl':86400,'type':'a'}]

Create DNS Zone

POST /dns.json

Implementation Notes
Create a DNS zone. On successful call, the created zone ID will be returned
Parameters
Name Type Required Description
name string Yes Name of the DNS Zone
record_a string Yes Initial IPv4 address for the zone
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'name' => 'string',
		'record_a' => 'string'
);

try {
    $response = $teraClient->post('/dns.json',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

123456

Remove DNS Zone

DELETE /dns.json/{zone}

Implementation Notes
Remove a DNS zone
Parameters
Name Type Required Description
zone integer Yes DNS Zone ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'zone' => 'integer'
);

try {
    $response = $teraClient->delete('/dns.json/{zone}',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

Add DNS Record

POST /dns.json/{zone}/records

Implementation Notes
Adds a DNS record to the specified zone
Parameters
Name Type Required Description
zone integer Yes DNS Zone ID
ttl integer Yes TTL for the new DNS record
type string Yes One of: a, aaaa, cname, mx, txt
host string Yes Hostname of the new record
data string Yes Data portion (IP or FQDN) for new record
mxPriority integer No Priority for MX record. Required only if adding new MX Record
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'zone' => 'integer',
		'ttl' => 'integer',
		'type' => 'string',
		'host' => 'string',
		'data' => 'string',
		'mxPriority' => 'integer'
);

try {
    $response = $teraClient->post('/dns.json/{zone}/records',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

12345678

Modify DNS Record

PUT /dns.json/{zone}/records/{record}

Implementation Notes
Modify an existing DNS zone
Parameters
Name Type Required Description
zone integer Yes DNS Zone ID
record integer Yes DNS Record ID
field string Yes Value of domain's resource record. Usually set to 'data'
value string Yes Value to set the resource record field to
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'zone' => 'integer',
		'record' => 'integer',
		'field' => 'string',
		'value' => 'string'
);

try {
    $response = $teraClient->put('/dns.json/{zone}/records/{record}',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

Remove DNS Record

DELETE /dns.json/{zone}/records/{record}

Implementation Notes
Remove a DNS record
Parameters
Name Type Required Description
zone integer Yes DNS Zone ID
record integer Yes DNS Record ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'zone' => 'integer',
		'record' => 'integer'
);

try {
    $response = $teraClient->delete('/dns.json/{zone}/records/{record}',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

IP

					

List IP Addresses

GET /ip.json/{server}

Implementation Notes
Get IPv4 addresses that belong to a server
Parameters
Name Type Required Description
server integer Yes Server ID.
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'server' => 'integer'
);

try {
    $response = $teraClient->get('/ip.json/{server}',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'ip':'10.0.10.1','ptr':'test.example.com'},{'ip':'192.168.1.1','ptr':'notreal.example.com'}]

Set IP PTR

PUT /ip.json/{server}/{ip}

Implementation Notes
Set an IPv4 address PTR record
Parameters
Name Type Required Description
server integer Yes Server ID.
ip string Yes IP address to set (with periods).
ptr string Yes hostaname to resolve IP address to.
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'server' => 'integer',
		'ip' => 'string',
		'ptr' => 'string'
);

try {
    $response = $teraClient->put('/ip.json/{server}/{ip}',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'boolean'

Orders

					

Get Server Plans

GET /orders.json/servers

Implementation Notes
Get available server plans
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    //empty
);

try {
    $response = $teraClient->get('/orders.json/servers',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'plan_id': 1942, 'plan_title':'Dual E5-2650', 'plan_price':429.15, 'server_description':'32GB RAM / 2 x 1TB HDD / 1Gbit Port / 100TB Bandwidth'}]

Get All Locations

GET /orders.json/locations

Implementation Notes
Get all locations
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    //empty
);

try {
    $response = $teraClient->get('/orders.json/locations',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'location_id':2000, 'location_title':'Salt Lake City'}]

Get Addon Groups

GET /orders.json/addon_groups

Implementation Notes
Get all addon groups
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    //empty
);

try {
    $response = $teraClient->get('/orders.json/addon_groups',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'group_id':1, 'group_title':'Memory Upgrade'}]

Get Available Addons

GET /orders.json/addons

Implementation Notes
Get all available addons for a specified server and location
Parameters
Name Type Required Description
server_id integer Yes The server to get available addons for.
location_id integer Yes The location to check availability at.
billing_period integer Yes Billing period length. (monthly: 1, quarterly: 3, semiannually:6, annually: 12)
addon_group_id integer No The group of addons to get (If omitted or 0, returns all groups).
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'server_id' => 'integer',
		'location_id' => 'integer',
		'billing_period' => 'integer',
		'addon_group_id' => 'integer'
);

try {
    $response = $teraClient->get('/orders.json/addons',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'addon_id':3000, 'addon_title':'Fedora 15', 'group_id':2, 'group_title':'Operating System'}]

Submit Server Order

POST /orders.json/server

Implementation Notes
Submit order for processing or preview
Parameters
Name Type Required Description
server_id integer Yes server plan id
operating_system_id integer Yes operating system id
location_id integer Yes location id
billing_period integer No (Optional) Billing period length. Defaults to monthly. Values: [monthly: 1, quarterly: 3, semiannually:6, annually: 12]
$addon_ids array No (Optional) An array of addon ids
coupon_code string No (Optional) A coupon to apply to the order
hostname string No (Optional) The hostname to use when provisioning the server.
preview boolean No (Optional) Defaults to true. Must be set to false for order to be submitted for processing, otherwise, a preview of the order is returned.
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'server_id' => 'integer',
		'operating_system_id' => 'integer',
		'location_id' => 'integer',
		'billing_period' => 'integer',
		'$addon_ids' => 'array',
		'coupon_code' => 'string',
		'hostname' => 'string',
		'preview' => 'boolean'
);

try {
    $response = $teraClient->post('/orders.json/server',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

1

Servers

					

Get Servers

GET /servers.json

Implementation Notes
Get a list of all servers assigned to account
Parameters
Name Type Required Description
limit integer No Only fetch $limit records
offset integer No Fetch records starting at $offset
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'limit' => 'integer',
		'offset' => 'integer'
);

try {
    $response = $teraClient->get('/servers.json',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'id':12345,'fqdn':'reseller.example.com','public_ip':'255.255.255.255','private_ip':'10.10.0.1','unlimited':false,'pet_name':'my first server'}]

Get Server Profile

GET /servers.json/{server}

Implementation Notes
Get full server profile
Parameters
Name Type Required Description
server integer Yes Server ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'server' => 'integer'
);

try {
    $response = $teraClient->get('/servers.json/{server}',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'id':12345,'fqdn':'reseller.example.com','public_ip':'255.255.255.255','private_ip':'10.10.0.1','unlimited':false,'pet_name':'my first server','ips':[{'ip':'255.255.255.255','ptr':'reversedns.reseller.example.com'}],'info':{'login_details':{'username':'myuser','password':'mypassword'},'os':'Ubuntu','datacenter':'Seattle / Server Room 4','active_transactions':'','notes':'','monitoring':''}}]

Get Raw Bandwidth

GET /servers.json/{server}/bandwidth

Implementation Notes
Returns raw bandwidth data. The start parameter is required if a custom date range is needed, otherwise it is optional. If a custom date range is provided, the period parameter is ignored and a maximum of 40 date intervals are returned.
Parameters
Name Type Required Description
server integer Yes Server ID
period string No Graph period (daily, weekly, monthly, yearly, billing). Weekly by default
start integer No Start date (UNIX timestamp). Required if custom date range is needed, otherwise optional.
end integer No End date (UNIX timestamp). If not provided, will use today as end date.
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'server' => 'integer',
		'period' => 'string',
		'start' => 'integer',
		'end' => 'integer'
);

try {
    $response = $teraClient->get('/servers.json/{server}/bandwidth',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

Get Bandwidth Graph

GET /servers.json/{server}/bandwidth_graph

Implementation Notes
Returns raw PNG image data of the bandwidth graph. The start parameter is required if a custom date range is needed, otherwise it is optional. If a custom date range is provided, the period parameter is ignored.
Parameters
Name Type Required Description
server integer Yes Server ID
period string No Graph period (daily, weekly, monthly, yearly, billing). Weekly by default
start integer No Start date (UNIX timestamp). Required if custom date range is needed, otherwise optional.
end integer No End date (UNIX timestamp). If not provided, will use today as end date.
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'server' => 'integer',
		'period' => 'string',
		'start' => 'integer',
		'end' => 'integer'
);

try {
    $response = $teraClient->get('/servers.json/{server}/bandwidth_graph',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'graph.png'

Get Power Status

GET /servers.json/{server}/power_status

Implementation Notes
Get the power status for a server. On = 1, Off = 0
Parameters
Name Type Required Description
server integer Yes Server ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'server' => 'integer'
);

try {
    $response = $teraClient->get('/servers.json/{server}/power_status',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

1

Reboot Server

POST /servers.json/{server}/reboot

Implementation Notes
Gracefully reboot a server
Parameters
Name Type Required Description
server integer Yes Server ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'server' => 'integer'
);

try {
    $response = $teraClient->post('/servers.json/{server}/reboot',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'Server is rebooting'

Power On Server

POST /servers.json/{server}/power_on

Implementation Notes
Power On a server
Parameters
Name Type Required Description
server integer Yes Server ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'server' => 'integer'
);

try {
    $response = $teraClient->post('/servers.json/{server}/power_on',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'Server is powering on'

Power Off Server

POST /servers.json/{server}/power_off

Implementation Notes
Power Off a server
Parameters
Name Type Required Description
server integer Yes Server ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'server' => 'integer'
);

try {
    $response = $teraClient->post('/servers.json/{server}/power_off',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'Server is powering off'

Reboot - Rescue Mode

POST /servers.json/{server}/rescue

Implementation Notes
Rescue mode provides the ability to bring a server online to troubleshoot system problems that would normally only be resolved by an OS Reload. When the rescue occurs, the server will shutdown and reboot on to the public network with the same IP's assigned to the server to allow for remote connections. The server will be offline for approximately 10 minutes while the rescue is in progress. The server login credentials will be the same as what are listed on the server's profile.
Parameters
Name Type Required Description
server integer Yes Server ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'server' => 'integer'
);

try {
    $response = $teraClient->post('/servers.json/{server}/rescue',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'Server is rebooting to rescue mode'

Enable Public Port

POST /servers.json/{server}/enable

Implementation Notes
Enables a server's public network port. The maximum allowed speed will be set on the network port if the speed parameter is not provided.
Parameters
Name Type Required Description
server integer Yes Server ID
speed integer No Speed to set the network port to
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'server' => 'integer',
		'speed' => 'integer'
);

try {
    $response = $teraClient->post('/servers.json/{server}/enable',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'Public network port speed setting of $speed was successful'

Disable Public Port

POST /servers.json/{server}/disable

Implementation Notes
Disable public network port on a server.
Parameters
Name Type Required Description
server integer Yes Server ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'server' => 'integer'
);

try {
    $response = $teraClient->post('/servers.json/{server}/disable',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'Public network port speed setting of $speed was successful'

VPS

					

Get VPS Plans

GET /vps.json/plans

Implementation Notes
Get a list of the available SSD VPS plans
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    //empty
);

try {
    $response = $teraClient->get('/vps.json/plans',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'id':2449, 'label': '2 Cores / 4GB RAM / 70GB SSD / 5TB Bandwidth', 'price':38.00}]

Get VPS Locations

GET /vps.json/locations

Implementation Notes
Get a list of the available SSD VPS locations
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    //empty
);

try {
    $response = $teraClient->get('/vps.json/locations',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'id': 2, 'title': 'New York City, New York, US'}]

Get VPS Templates

GET /vps.json/templates/{locationId}

Implementation Notes
Get a list of the available SSD VPS templates at a selected location
Parameters
Name Type Required Description
locationId integer Yes Location ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'locationId' => 'integer'
);

try {
    $response = $teraClient->get('/vps.json/templates/{locationId}',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'label': 'Ubuntu 14.04 x64 ','min_disk_size': 5,'min_memory_size': 256,'operating_system': 'linux','operating_system_arch': 'x64'}]

Create VPS

POST /vps.json

Implementation Notes
Purchase, create, and configure a new SSD VPS
Parameters
Name Type Required Description
planId integer Yes Plan Id
locationId integer Yes Location ID
templateId integer Yes Template ID
label string Yes Label
hostname string Yes Hostname
password string No Password
backups boolean No Enable Backups
billHourly boolean No Bill Hourly
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'planId' => 'integer',
		'locationId' => 'integer',
		'templateId' => 'integer',
		'label' => 'string',
		'hostname' => 'string',
		'password' => 'string',
		'backups' => 'boolean',
		'billHourly' => 'boolean'
);

try {
    $response = $teraClient->post('/vps.json',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'server': '0881','ip': '192.168.1.1','assigned': 1442262928,'backups': true,'hourly': false}]

Delete VPS

DELETE /vps.json/servers/{id}

Implementation Notes
Destroy VPS from account and cancel billing.
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    //empty
);

try {
    $response = $teraClient->delete('/vps.json/servers/{id}',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'true'

Get VPS List

GET /vps.json/servers

Implementation Notes
Get a list of all SSD VPSs in your account
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    //empty
);

try {
    $response = $teraClient->get('/vps.json/servers',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'id': 10, 'label':'My VPS', 'hostname':'example.com', 'ip_address':'192.168.0.1', 'location_title':'Salt Lake City, Utah, US'}]

Get VPS

GET /vps.json/servers/{id}

Implementation Notes
Get in depth details for a SSD VPS
Parameters
Name Type Required Description
id integer Yes SSD VPS ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'id' => 'integer'
);

try {
    $response = $teraClient->get('/vps.json/servers/{id}',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'cpus': 4, 'created_at':'2015-05-07T17:50:18+00:00', 'hostname':'example.com', 'id':10, 'initial_root_password':'myTestPass123', 'memory':2048,'operating_system_distro':'ubuntu', 'etc':'...'}]

Get VPS Stats

GET /vps.json/servers/{id}/stats

Implementation Notes
Retrieve raw snapshot data of VPSs statistics for the past 30 days (data fields represented in Kilobytes)
Parameters
Name Type Required Description
id integer Yes SSD VPS ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'id' => 'integer'
);

try {
    $response = $teraClient->get('/vps.json/servers/{id}/stats',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'id':10,'data_read':1448,'data_received':242852,'data_sent':808,'data_written':182828,'reads_completed':106,'writes_completed':7100,'cpu_usage':0.0208,'start_date':1431894985,'end_date':1432067785}]

Get Status

GET /vps.json/servers/{id}/status

Implementation Notes
Get VPS Power Status
Parameters
Name Type Required Description
id integer Yes SSD VPS ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'id' => 'integer'
);

try {
    $response = $teraClient->get('/vps.json/servers/{id}/status',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'status':1, 'status_message':'Powered Off'}]

Startup VPS

POST /vps.json/servers/{id}/startup

Implementation Notes
Startup a SSD VPS
Parameters
Name Type Required Description
id integer Yes SSD VPS ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'id' => 'integer'
);

try {
    $response = $teraClient->post('/vps.json/servers/{id}/startup',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'Startup action has been queued.'

Shutdown VPS

POST /vps.json/servers/{id}/shutdown

Implementation Notes
Shutdown a SSD VPS
Parameters
Name Type Required Description
id integer Yes SSD VPS ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'id' => 'integer'
);

try {
    $response = $teraClient->post('/vps.json/servers/{id}/shutdown',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'Shutdown action has been queued.'

Reboot VPS

POST /vps.json/servers/{id}/reboot

Implementation Notes
Reboot a SSD VPS
Parameters
Name Type Required Description
id integer Yes SSD VPS ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'id' => 'integer'
);

try {
    $response = $teraClient->post('/vps.json/servers/{id}/reboot',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'Reboot action has been queued.'

Recovery Reboot VPS

POST /vps.json/servers/{id}/recovery_reboot

Implementation Notes
Reboot a SSD VPS in Recovery Mode
Parameters
Name Type Required Description
id integer Yes SSD VPS ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'id' => 'integer'
);

try {
    $response = $teraClient->post('/vps.json/servers/{id}/recovery_reboot',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'Recovery Reboot action has been queued.'

Reset VPS Password

POST /vps.json/servers/{id}/reset_password

Implementation Notes
Reset the root password for a SSD VPS
Parameters
Name Type Required Description
id integer Yes SSD VPS ID
password string Yes New Root Password
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'id' => 'integer',
		'password' => 'string'
);

try {
    $response = $teraClient->post('/vps.json/servers/{id}/reset_password',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'VPS root password successfully changed.'

Get Console Access

GET /vps.json/servers/{id}/console

Implementation Notes
Get Console Access URL for a SSD VPS
Parameters
Name Type Required Description
id integer Yes SSD VPS ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'id' => 'integer'
);

try {
    $response = $teraClient->get('/vps.json/servers/{id}/console',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'http://hypervisor_url/console_remote/access_key'

Backups List

GET /vps.json/servers/{id}/backups

Implementation Notes
List backups available for SSD VPS
Parameters
Name Type Required Description
id integer Yes SSD VPS ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'id' => 'integer'
);

try {
    $response = $teraClient->get('/vps.json/servers/{id}/backups',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'allow_resize_without_reboot': true, 'backup_size': 325868, 'built': true, 'built_at': '2015-04-27T06:52:32+00:00', 'id': 80982, 'locked': false, 'etc': '...'}]

Backups Note

POST /vps.json/servers/{id}/backups/{backupId}/note

Implementation Notes
Add note to a SSD VPSs backup
Parameters
Name Type Required Description
id integer Yes SSD VPS ID
backupId integer Yes SSD backup image ID
note string Yes String text for notation
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'id' => 'integer',
		'backupId' => 'integer',
		'note' => 'string'
);

try {
    $response = $teraClient->post('/vps.json/servers/{id}/backups/{backupId}/note',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'true'

Backups Delete

DELETE /vps.json/servers/{id}/backups/{backupId}

Implementation Notes
Delete a SSD VPS Backup
Parameters
Name Type Required Description
id integer Yes SSD VPS ID
backupId integer Yes SSD backup image ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'id' => 'integer',
		'backupId' => 'integer'
);

try {
    $response = $teraClient->delete('/vps.json/servers/{id}/backups/{backupId}',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'true'

Backups Restore

POST /vps.json/servers/{id}/backups/{backupId}/restore

Implementation Notes
Restore a SSD VPS Backup. (Overwrites existing SSD VPS with backed up image)
Parameters
Name Type Required Description
id integer Yes SSD VPS ID
backupId integer Yes SSD backup image ID
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    'id' => 'integer',
		'backupId' => 'integer'
);

try {
    $response = $teraClient->post('/vps.json/servers/{id}/backups/{backupId}/restore',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

'true'

Updates

					

Get Active Updates

GET /updates.json

Implementation Notes
Get a list of active status updates
Sandbox
Parameters
						
						
$teraClient = new TeraClient('PLACE_KEY_HERE');

$params = array(
    //empty
);

try {
    $response = $teraClient->get('/updates.json',$params);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage();
}
						
						
HTTP 200 OK

[{'id':'8','title':'DDOS','dc':'London','posted':'2015-01-29','status':'Our network engineers are working on mitigating the network traffic being caused by the DOS attack at the London DC','date':'2015-01-29 14:38:09'}]