Application Programming Interface

Get Snapshot Detail


Description:

This function enables you to get snapshot detail.

URLs:
  • Sandbox URL: https://virtdedi.com/api-sandbox/v1/get_snapshot_detail
  • Real API URL: https://virtdedi.com/api/v1/get_snapshot_detail
Request Parameters:
Parameter Required Type Max Length Description
snapshot_id Yes String 50 characters The ID of snapshot you want to get its detail.
client_ip_address Yes String 20 Public IP address (v4) which is allowed to access for a given time specified in "snapshot_url_expires" output parameter. For example: 103.219.248.10
JSON Response:
    
        
{
    "code"    : "OK",
    "message" : "",
    "data"    : {
        "snapshot_id"          : "hjagsdjhg89",
        "server_id"            : "12345",
        "server_label"         : "My Server One",
        "snapshot_name"        : "hjasgdjuasujqk.disk",
        "snapshot_add_time"    : "2016-09-10 00:00:12",
        "snapshot_end_time"    : "",
        "snapshot_cycle"       : "daily",
        "snapshot_status"      : "active",
        "snapshot_size"        : 3.2,
        "snapshot_url"         : "http://snapshot-007.backup.co.id/aasllasd/sd/hjasgdjuasujqk.disk?md5=jhgHGag_asdaFS&expired=1483728440",
        "snapshot_url_expires" : 1483728440
    }
}
    
XML Response:
    
        
<?xml version="1.0" encoding="utf-8"?>
<code>OK</code>
<message></message>
<data>
    <snapshot_id>hjagsdjhg89</snapshot_id>
    <server_id>12345</server_id>
    <server_label>My Server One</server_label>
    <snapshot_name>hjasgdjuasujqk.disk</snapshot_name>
    <snapshot_add_time>2016-09-10 00:00:12</snapshot_add_time>
    <snapshot_end_time></snapshot_end_time>
    <snapshot_cycle>daily</snapshot_cycle>
    <snapshot_status>active</snapshot_status>
    <snapshot_size>3.2</snapshot_size>
    <snapshot_url>http://snapshot-007.backup.co.id/aasllasd/sd/hjasgdjuasujqk.disk?md5=jhgHGag_asdaFS&expired=1483728440</snapshot_url>
    <snapshot_url_expires>1483728440</snapshot_url_expires>
</data>
    
PHP Example:
    
        
<?php
$url      = "https://virtdedi.com/api-sandbox/v1/get_snapshot_detail";
//$url    = "https://virtdedi.com/api/v1/get_snapshot_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,
    "snapshot_id"       => "hjgasd7hagdj",
    "client_ip_address" => "103.219.248.10",
);
$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
        }
    }
}