Application Programming Interface

Create Server


Description:

This function enables you to create server. Please note that you are eligible to create server if you have:

  • No unpaid/overdue invoices
  • Positive credit balance

URLs:
  • Sandbox URL: https://virtdedi.com/api-sandbox/v1/create_server
  • Real API URL: https://virtdedi.com/api/v1/create_server
Request Parameters:
Parameter Required Type Max Length Description
package Yes String 12 characters Available options:
  • ryzen9950x
  • epyc7763
vcpu Yes Integer 2 digits The dedicated vCPU core.
Min: 1, max: 30 for Ryzen, 120 for EPYC.
Primary NVME disk size is vCPU * 50GB.
Memory size is vCPU * 4GB.
Monthly data transfer is vCPU * 2TB.
server_label Yes String 50 characters The label of the server
hostname Yes String 50 characters It should be FQDN (fully qualified domain name).
install_source Yes String 8 characters Available options:
  • template
  • backup
  • iso
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.
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)
backup_id Conditional String 50 characters Only active backup from OS template installation with same or lower package an be used. It is required if you choose backup as install source.
restore_hdd Conditional String 50 characters It is available if your backup has secondary HDD storage. Available options:
  • yes
  • no (default)
root_password Conditional String 5-15 characters It is available if you choose template or backup as install source. Random password will be generated if it is not set.
iso_file_option Conditional String 20 characters It is required if you choose iso as install source. Available options:
  • cached_iso_file
  • own_iso_file
cached_iso_file Conditional String 255 characters It should be valid cached ISO file. It is required if you choose cached iso file as install source. You can get cached ISO file list with get_cached_iso_file_list function.
iso_url Conditional String 255 characters It should be valid URL to an ISO file. It is required if you choose own 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:
  • ID.DATAHALL
additional_monthly_data_transfer No Integer 3 digits Additional monthly data transfer in TB
daily_backup No String 5 characters Available options:
  • yes
  • no (default)
daily_backup_max_age Conditional Integer (days) 2 digits The days you want to retain the daily backup files. This parameter is required if "daily_backup" value is "yes".
Minimum value: 1
weekly_backup No String 5 characters Available options:
  • yes
  • no (default)
weekly_backup_max_age Conditional Integer (weeks) 2 digits The weeks you want to retain the weekly backup files. This parameter is required if "weekly_backup" value is "yes".
Minimum value: 1
monthly_backup No String 5 characters Available options:
  • yes
  • no (default)
monthly_backup_max_age Conditional Integer (months) 2 digits The months you want to retain the monthly backup files. This parameter is required if "monthly_backup" value is "yes".
Minimum value: 1
hdd No Integer 3 digits Optional secondary HDD storage in TB
hdd_backup No Integer 3 digits Include Secondary HDD Storage in Backup Proces. Available options:
  • yes
  • no (default)
billing_cycle No String 50 characters Available options:
  • 1monthly (for Monthly - default)
  • 3monthly (for Quarterly)
  • 6monthly (for Semi-Annually)
  • 1yearly (for Annually)
  • 2yearly (for Biennially)
  • 3yearly (for Triennially)
pay_with_balance No String 50 characters Available options:
  • yes (default)
  • no
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.
JSON Response:
    
        
{
    "code"    : "OK",
    "message" : "The server installation process is pending for payment",
    "data"    : {
        "server_id"     : "1122334",
        "order_status"  : "pending",
        "server_status" : "none"
    }
}
    
XML Response:
    
        
<?xml version="1.0" encoding="utf-8"?>
<code>OK</code>
<message>The server installation process is pending for payment</message>
<data>
    <server_id>1122334</server_id>
    <order_status>pending</order_status>
    <server_status>none</server_status>
</data>
    
PHP Example:
    
        
<?php
$url      = "https://virtdedi.com/api-sandbox/v1/create_server";
//$url    = "https://virtdedi.com/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
        }
    }
}