Introduction
Get Arch List
Get OS Variant List
Get OS Template List
Get Server List
Get Server Detail
Create Server
Cancel Server
Reinstall Server
Turn Server On
Turn Server Off
Change Server Label
Change Server Hostname
Change Reverse Host
Set Server Custom Info
Change Server Password
Get Server Virtual Monitor URL
Get Server Shared Access List
Add Server Shared Access
Delete Server Shared Access
Get Snapshot List
Get Snapshot Detail
Create Snapshot
Delete Snapshot
Set Server Snapshot Schedule
This function enables you to create server. Please note that you are eligible to create server if you have:
Parameter | Required | Type | Max Length | Description |
---|---|---|---|---|
package | Yes | String | 12 characters |
Available options:
|
vcpu | Conditional | Integer | 2 digits |
The vCPU core. It is required if you choose custom as package.
Min: 2, max: 24. |
ram | Conditional | Integer | 2 digits |
The Memory in GB. It is required if you choose custom as package.
Min: 2, max: 64. |
ssd | Conditional | Integer | 3 digits |
The SSD in GB. It is required if you choose custom as package.
Min: 20, max: 600. |
server_label | Yes | String | 50 characters | The label of the server |
install_source | Yes | String | 8 characters |
Available options:
|
os_template | Conditional | String | 50 characters | It is required if you choose template as install source. You can get OS template list with get_os_template_list function. |
hostname | Conditional | String | 50 characters | It should be FQDN (fully qualified domain name). It is required if you choose template or snapshot as install source. |
ssh_keys | No | String | 10 keys | If you want more than 1 ssh key, saparate them with carriage return (enter string). You can get your ssh key in your ~/.ssh/is_rsa.pub by executing this command: ssh-keygen -t rsa (Linux, Unix, BSD, Mac) |
snapshot_id | Conditional | String | 50 characters | Only active snapshot from OS template installation with same or lower package an be used. It is required if you choose snapshot as install source. |
iso_url | Conditional | String | 255 characters | It should be valid URL to an ISO file. It is required if you choose iso as install source. |
os_variant | Conditional | String | 50 characters | It is required if you choose iso as install source. You can get OS variant list with get_os_variant_list function. |
arch | Conditional | String | 10 characters | It is required if you choose iso as install source. You can get arch list with get_arch_list function. |
data_center | No | String | 20 characters |
Current available options:
|
ip_address | No | String | 20 characters | Static IP address v4 from your booking list you want to use in the new server instance. If this parameter is not supplied, a random IP address will be used. |
ddos_protection | No | String | 3 characters |
Available options:
|
custom_info_1 | No | String | 50 characters | Your server custom info 1 |
custom_info_2 | No | String | 50 characters | Your server custom info 2 |
custom_info_3 | No | String | 50 characters | Your server custom info 3 |
Custom info let you identify you servers with your own identifier. These are useful for resellers, for example, to determine customer ID, package bundle, etc.
{
"code" : "OK",
"message" : "The server installation process has been started",
"data" : {
"server_id" : "1122334",
"order_status" : "active",
"server_status" : "install"
}
}
<?xml version="1.0" encoding="utf-8"?>
<code>OK</code>
<message>The server installation process has been started</message>
<data>
<server_id>1122334</server_id>
<order_status>active</order_status>
<server_status>install</server_status>
</data>
<?php
$url = "https://node.co.id/api-sandbox/v1/create_server";
//$url = "https://node.co.id/api/v1/create_server";
$user_id = "12312";
$API_key = "hasdh6ghvhgFDa454565jasdbNBS";
$random = rand(10000,99999).uniqid().rand(100000,999999);
$checksum = sha1(sha1(sha1($user_id.$API_key.$random)));
$data = array(
"user_id" => $user_id,
"random" => $random,
"format" => "json",
"checksum" => $checksum,
"server_label" => "My Cool Server",
"package" => "compute1",
"install_source" => "template",
"os_template" => "centos-6-64",
"hostname" => "myserver.mydomain.com"
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$output = curl_exec($ch);
$curl_error = curl_errno($ch);
curl_close($ch);
if ($curl_error){
echo "Unable to connect to API Server.";
} else {
$outputArray = json_decode($output,true);
if (!$outputArray){
echo "Invalid JSON Format";
} else {
if ($outputArray["code"] == "OK"){
print_r($outputArray);
// Do what you want to do here if OK
} else {
echo "Error Message: ".$outputArray["message"];
// Do what you want to do here if not OK
}
}
}