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 add shared access to a server instance.
Parameter | Required | Type | Max Length | Description |
---|---|---|---|---|
server_id | Yes | String | 50 characters | The ID of server you want to add shared access to it. |
Yes | String | 50 characters | Email address you want to share with. If the email has been shared before, it will be replaced by new defined accesses. | |
virtual_monitor | No | String | 15 characters |
Available options:
|
change_label | No | String | 3 characters |
Available options:
|
view_password | No | String | 3 characters |
Available options:
|
change_password | No | String | 3 characters |
Available options:
|
turn_on | No | String | 3 characters |
Available options:
|
turn_off | No | String | 3 characters |
Available options:
|
reinstall | No | String | 3 characters |
Available options:
|
change_reverse_host | No | String | 3 characters |
Available options:
|
view_snapshot | No | String | 3 characters |
Available options:
|
create_snapshot | No | String | 3 characters |
Available options:
|
delete_snapshot | No | String | 3 characters |
Available options:
|
{
"code" : "OK",
"message" : "The server access has been shared to someone@gmail.com",
"data" : {
"server_id" : "12345",
"email" : "someone@gmail.com",
"user_id" : "123456",
"full_name" : "John Doe",
"virtual_monitor" : "full_access",
"change_label" : "yes",
"view_password" : "yes",
"change_password" : "yes",
"turn_on" : "yes",
"turn_off" : "yes",
"reinstall" : "yes",
"change_reverse_host" : "yes",
"view_snapshot" : "yes",
"create_snapshot" : "yes",
"delete_snapshot" : "yes"
}
}
<?xml version="1.0" encoding="utf-8"?>
<code>OK</code>
<message>The server access has been shared to someone@gmail.com</message>
<data>
<server_id>12345</server_id>
<email>someone@gmail.com</email>
<user_id>123456</user_id>
<full_name>John Doe</full_name>
<virtual_monitor>full_access</virtual_monitor>
<change_label>yes</change_label>
<view_password>yes</view_password>
<change_password>yes</change_password>
<turn_on>yes</turn_on>
<turn_off>yes</turn_off>
<reinstall>yes</reinstall>
<change_reverse_host>yes</change_reverse_host>
<view_snapshot>yes</view_snapshot>
<create_snapshot>yes</create_snapshot>
<delete_snapshot>yes</delete_snapshot>
</data>
<?php
$url = "https://node.co.id/api-sandbox/v1/add_server_shared_access";
//$url = "https://node.co.id/api/v1/add_server_shared_access";
$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",
"email" => "someone@domain.com",
"virtual_monitor" => "full_access",
"view_password" => "yes"
);
$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
}
}
}