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:
The base URL to use for the API is https://www.take2hosting.com/?p=api&header=no
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:
|
||||||||||||||||||||||||||||||||||
bandwidth | bandwidth must be used with service newserver. If you specify service newserver
then bandwidth is required. Choose a numeric bandwidth plan:
|
||||||||||||||||||||||||||||||||||
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:
|
||||||||||||||||||||||||||||||||||
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:
|
||||||||||||||||||||||||||||||||||
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