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
Delete Snapshot
Set Server Snapshot Schedule
This function enables you to set a server custom_info.
Parameter | Required | Type | Max Length | Description |
---|---|---|---|---|
server_id | Yes | String | 50 characters | The ID of server you want to change its label. |
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 |
{
"code" : "OK",
"message" : "The server custom info has been set.",
"data" : {
"server_id" : "12345",
"custom_info_1" : "Cust-0021",
"custom_info_2" : "mypackage-x",
"custom_info_3" : ""
}
}
<?xml version="1.0" encoding="utf-8"?>
<code>OK</code>
<message>The server custom info has been set.</message>
<data>
<server_id>12345</server_id>
<custom_info_1>Cust-0021</custom_info_1>
<custom_info_2>mypackage-x</custom_info_2>
<custom_info_3></custom_info_3>
</data>
<?php
$url = "https://virtdedi.com/api-sandbox/v1/set_server_custom_info";
//$url = "https://virtdedi.com/api/v1/set_server_custom_info";
$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_id" => "12345",
"custom_info_1" => "Cust-0021",
"custom_info_2" => "mypackage-x"
);
$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
}
}
}