Application Programming Interface

Introduction


The API has 2 stages: (1) sandbox for development purpose and (2) the real API.

  • Sandbox URL: https://node.co.id/api-sandbox/v1/{function-name}
  • Real API URL: https://node.co.id/api/v1/{function-name}

The API accepts both HTTP GET and POST request, but we strongly recommend to use HTTP POST.

Every making request, you should provide following parameters:

  • user_id: You can get your user id in your account status page.
  • random: This is random string. You can create random string with your own way, for example with function uniqid() in PHP.
  • checksum: This is important part to make sure it is you making API request. The checksum is result of 3 times of sha1 of following string: user_id, API key, and random string above. You can get your API key in your account status page.
  • format (optional): json (recommended) or xml. If you do not provide the value, json is the default.
  • And other function specific parameters.

Every responses consist of following values:

  • code: The response code. If the operation succeed, the code is OK.
  • message: Additional information about the response.
  • data: The returned data if exists.

PHP Example:
    
        
<?php
$url      = "https://node.co.id/api-sandbox/v1/get_server_detail";
//$url    = "https://node.co.id/api/v1/get_server_detail";
$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" => "34512" // This parameter is required
                           // by get_server_detail function
);

$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
        }
    }
}