Application Programming Interface

Get Server Shared Access List


Description:

This function enables you to get shared access list of a server instance.

URLs:
  • Sandbox URL: https://node.co.id/api-sandbox/v1/get_server_shared_access_list
  • Real API URL: https://node.co.id/api/v1/get_server_shared_access_list
Request Parameters:
Parameter Required Type Max Length Description
server_id Yes String 50 characters The ID of server you want to get its shared access list.
JSON Response:
    
        
{
    "code"    : "OK",
    "message" : "",
    "data"    : {
        "server_id"    : "12345",
        "shared_accesses" : {
            "0" : {
                "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"
            },
            "1" : {
                "email"               : "someone@yahoo.com",
                "user_id"             : "",
                "full_name"           : "",
                "virtual_monitor"     : "read_only",
                "change_label"        : "no",
                "view_password"       : "no",
                "change_password"     : "no",
                "turn_on"             : "no",
                "turn_off"            : "no",
                "reinstall"           : "no",
                "change_reverse_host" : "no",
                "view_snapshot"       : "yes",
                "create_snapshot"     : "no",
                "delete_snapshot"     : "no"
            },
            .........................
        }
    }
}
    
XML Response:
    
        
<?xml version="1.0" encoding="utf-8"?>
<code>OK</code>
<message></message>
<data>
    <server_id>12345</server_id>
    <shared_accesses>
        <record>
            <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>
        </record>
        <record>
            <email>someone@yahoo.com</email>
            <user_id></user_id>
            <full_name></full_name>
            <virtual_monitor>read_only</virtual_monitor>
            <change_label>no</change_label>
            <view_password>no</view_password>
            <change_password>no</change_password>
            <turn_on>no</turn_on>
            <turn_off>no</turn_off>
            <reinstall>no</reinstall>
            <change_reverse_host>no</change_reverse_host>
            <view_snapshot>yes</view_snapshot>
            <create_snapshot>no</create_snapshot>
            <delete_snapshot>no</delete_snapshot>
        </record>
        .........................
    </shared_accesses>
</data>
    
PHP Example:
    
        
<?php
$url      = "https://node.co.id/api-sandbox/v1/get_server_shared_access_list";
//$url    = "https://node.co.id/api/v1/get_server_shared_access_list";
$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"
);
$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
        }
    }
}