Take 2 Hosting API
The Take 2 Hosting API FAQ includes answers to many frequently asked questions as well as links to valuable information you may find useful while utilizing our services. Please note that many of the links provided in our FAQs are not directly hosted by Take 2 Hosting.
Our Network API

We have a very simple and secure network API for advanced control of the Take 2 Hosting service features. The API is over HTTPS and data is sent via POST with name=value pairs like login=mjordan&password=basketball. The API performs all transactions in one request, so session management is not needed (ie: 1 server, 1 request).
The system uses no default values, so all required variables and values must be supplied for all requests.
A null or blank value should never be used. If a variable is required then a value is required.
If an error occured of any kind, you will see the word 'ERROR' and no part of the transaction will have started or completed. Results are atomic.
New customers must open a ticket to activate the API settings on your account.

The API lets you:
  • Provision a new server
  • Control power to an existing server
  • Reboot your server into network Rescue Mode
  • Re-install the OS on your server or change OSes and RAID level
  • Check the current status of the Take 2 Hosting Network


The base URL to use for the API is https://www.take2hosting.com/?p=api&header=no


Below is a table of all the variables that you may POST in a request:

POST Variables Description of Variable
 
login Your Take 2 Hosting account login (Required for all transactions)
 
password Your Take 2 Hosting account password (Required for all transactions)
 
service The service you wish to use: (Required for all transactions)

Valid values are:
  status: Check the status of the Take 2 Hosting Network.
  newserver: Provision a new server
  servercontrol: Control an existing server
  serveravailable: Check to see if servers are available (optionally takes the platform argument)
  serverplatformsavailable: Check to see if servers are available. All platforms are shown at once.
  serverstatus: Current information on all of your servers.
  getserverbyip: Returns the Server ID number of the server with the supplied IP Address. Requires an 'ipaddress' argument
  dns: Update reverse DNS for an IP Address
  getdns: Get reverse DNS for an IP Address

Example of getting Take 2 Hosting Status:
login=mjordan&password=basketball&service=status
 
testmode Set to '1' to turn test mode on. (testmode=1)
Everything will behave the same in test mode but nothing will really be done. All responses in test mode with begin with a testmode header that will look like: "testmode:on". Use testmode for ALL testing or you will be performing real actions. The API does not ask questions, and once you POST to the API the action has begun and can not be stopped. testmode may be used with any and all API calls.
To turn testmode off, simply do not include it, or set it to '0' (testmode=0)
 
nickname nickname must be used with the service newserver.
 
profile profile must be used with service newserver. If you specify service newserver then profile is required.

A choice of OS with architecture and RAID level:
ID OS and RAID
159:   CentOS 7.3.1611 64-Bit with no RAID
163:   CentOS 7.3.1611 64-Bit with no RAID 10
162:   CentOS 7.3.1611 64-Bit with no RAID 5
160:   CentOS 7.3.1611 64-Bit with RAID 0
161:   CentOS 7.3.1611 64-Bit with RAID 1
122:   Ubuntu 12.04 64-Bit with no RAID
120:   Ubuntu 12.04 64-Bit with RAID 0
121:   Ubuntu 12.04 64-Bit with RAID 1
136:   XenServer 6.2.0 with no RAID
137:   XenServer 6.2.0 with RAID 1 (Experimental)
 
bandwidth bandwidth must be used with service newserver. If you specify service newserver then bandwidth is required.

Choose a numeric bandwidth plan:

64:   10 Mbps
65:   50 Mbps
66:   100 Mbps
 
hostname hostname must be used with service newserver. If you specify service newserver, hostname is NOT required, but the server you order will be assigned a hostname that is your primary IP address.
hostname must be a valid hostname or it will be rejected. A hostname may contain only the ASCII letters 'a' through 'z' (case-insensitive), the digits '0' through '9', and the hyphen '-'. Hostname labels cannot begin or end with a hyphen. No other symbols, punctuation characters, or blank spaces are permitted.
 
domainname domainname must be used with service newserver. If you specify service newserver, domainname is NOT required, but the server you order will be assigned the domain name of 'take2hosting.com'.
domainname must be a valid domainname or it will be rejected. A domainame may contain only the ASCII letters 'a' through 'z' (case-insensitive), the digits '0' through '9', and the hyphen '-'. Domainname labels cannot begin or end with a hyphen. No other symbols, punctuation characters, or blank spaces are permitted.
 
network network must be used with service newserver. If you specify service newserver, network is NOT required, but the server you order will receive 1 usable IP address (a /30 network block or a netmask of 255.255.255.252). This is standard and is included with all server orders at no additional cost. However, ordering larger networks with a server will incure additional monthly fees. Each additional IP address is an additional $1/month.

Choose a numeric network plan:

30:     1 Usable IP address (/30 or 255.255.255.252) Included
29:     5 Usable IP addresses (/29 or 255.255.255.248) Additional $4/month
28:     13 Usable IP addresses (/28 or 255.255.255.240) Additional $12/month
27:     28 Usable IP addresses (/27 or 255.255.255.224) Additional $28/month
26:     61 Usable IP addresses (/26 or 255.255.255.192) Additional $60/month
 
platform platform must be used with service newserver. If you specify service newserver, platform is NOT required, but the server you order will default to a base platform type 1 (Single Quad Core Xeon 3210+ (2 GB RAM / 2x500 GB HD)). platform can also be used with the serveravailable query to see if servers are available in a specific platform.
Choose a numeric server platform type:

1:    Single Quad Core Xeon 3210+ (8 GB RAM / 2x500 GB HD)
2:    Single Quad Core Xeon 3210+ (8 GB RAM / 2x1000 GB HD)
4:    Single Quad Core Xeon 3400 Series (8 GB RAM / 2x500 GB HD)
3:    Single Quad Core Xeon 3210+ (8 GB RAM / 2x160 GB SSD)
5:    Single Quad Core Xeon 3400 Series (8 GB RAM / 2x1000 GB HD)
6:    Single Quad Core Xeon 3400 Series (8 GB RAM / 2x160 GB SSD)
7:    Single Quad Core Xeon 3400 Series (16 GB RAM / 2x500 GB HD)
18:    Single Quad Core Xeon E3-1200 Series (32 GB RAM / 4x500 GB HD)
17:    Single Quad Core Xeon E3-1200 Series (32 GB RAM / 2x1000 GB HD)
8:    Single Quad Core Xeon 3400 Series (16 GB RAM / 2x1000 GB HD)
9:    Single Quad Core Xeon 3400 Series (16 GB RAM / 2x160 GB SSD)
14:    Single Quad Core Xeon E3-1200 Series (32 GB RAM / 2x2000 GB HD)
10:    Dual Quad Core Xeon 5420+ (24 GB RAM / 2x1000 GB HD)
16:    Single Quad Core Xeon E3-1200 Series (32 GB RAM / 2x512 GB SSD)
11:    Dual Quad Core Xeon 5420+ (24 GB RAM / 4x1000 GB HD)
12:    Dual Quad Core Xeon 5420+ (24 GB RAM / 2x160 GB SSD)
13:    Dual Quad Core Xeon 5420+ (24 GB RAM / 4x160 GB SSD)
 
action action must be used with service servercontrol.
Valid actions are on, off, reboot, rescue and install
 
server server must be used with the service servercontrol and action.
If you wish to perform any action on a server, you must specify the ID number of the server.
 
dns This allows you to set the DNS Reverse Record (PTR) for your server IP addresses.
dns requires the 2 arguments of ipaddress and ptr

Example Reverse DNS update:
service=dns&ipaddress=10.0.0.1&ptr=www.yourdomain.com
 
getdns This allows you to get the DNS Reverse Record (PTR) for your server IP addresses.
getdns requires 1 argument of ipaddress

Example Reverse DNS get:
service=getdns&ipaddress=10.0.0.1
 
getserverinfo This allows you to get additional information for a specified server.
getserverinfo requires 1 argument of server

Example:
service=getserverinfo&server=100000


How the API works:

All requests POSTed will receive a response. If you are using testmode, you will see a 'testmode:on' header, followed by the response. Authentication is always validated, even in testmode, so you must have an active Take 2 Hosting account to successfully test the API.
All responses are in the form of 'CLASS:description' so an authentication failure error response would look like:

    ERROR:authentication failure

Some variables are required for all requests, like login, password and service. Other variables are required only for a specific service. So if you wanted to reboot a server you would use the following variables: login,password, service, action, server






Examples:






Here we use wget to test provisioning a new server where the server nick name is 'www', server Platform Type 1, the system Profile is CentOS 5.3 64-Bit with RAID 1 and the bandwidth Plan is 10 Mbps:

  /usr/bin/wget 'https://www.take2hosting.com/?p=api&header=no' --post-data="login=YOUR_LOGIN&password=YOUR_PASSWORD&testmode=1&service=newserver&nickname=www&profile=54&bandwidth=2&platform=1"

Which should respond with something similar to:

 action:new server ordered (1000000)

where '1000000' is the ID number of your new server.





Here we use curl to reboot server id 1000000:

  /usr/bin/curl -d "login=YOUR_LOGIN&password=YOUR_PASSWORD&service=servercontrol&action=reboot&server=1000000" 'https://www.take2hosting.com/?p=api&header=no'

Which should respond with:

 action:server rebooting




Here we use curl to reboot server id 1000000 into network rescue mode:

  /usr/bin/curl -d "login=YOUR_LOGIN&password=YOUR_PASSWORD&service=servercontrol&action=rescue&server=1000000" 'https://www.take2hosting.com/?p=api&header=no'

Which should respond with:

 action:server rebooting in rescue mode






Here we use curl to check the Take 2 Hosting Network Status:

  /usr/bin/curl -d "login=YOUR_LOGIN&password=YOUR_PASSWORD&service=status" 'https://www.take2hosting.com/?p=api&header=no'

Which should respond with something similar to:

network:Normal
boot:Normal
DNS:Normal
webserver:Normal
maintenance:None