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 get snapshot list. The snapshot list will be limited up to 100 records per request, divided into multipe pages (record sets). You can set the limit and the page. If you are reseller, we recommend you to store snapshot list in your own database for faster retrieval.
Parameter | Required | Type | Max Length | Description |
---|---|---|---|---|
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 |
records_per_page | No | Integer | 3 digits |
Minimum: 10 records per page. Maximum: 100 records per page. Default: 20 records per page. |
page | No | Integer | 10 digits | If the provided value is greater than max available pages, the max pages will be applied. Default is 1. |
sorted_by | No | String | 25 characters |
Available options:
|
ownership | No | String | 6 characters |
Available options:
|
snapshot_status | No | String | 10 characters |
Available options:
|
snapshot_cycle | No | String | 10 characters |
Available options:
|
server_id | No | String | 20 characters | If server ID is supplied, only snapshot from the server will be retrieved. |
{
"code" : "OK",
"message" : "",
"data" : {
"total_records" : 100,
"records_per_page" : 20
"total_pages" : 5,
"page" : 1,
"records" : {
"0" : {
"snapshot_id" : "adhjgahdad",
"server_id" : "12345",
"server_label" : "My Server One",
"snapshot_name" : "gashgajshgjahsdad.disk",
"snapshot_add_time" : "2016-09-20 00:00:12",
"snapshot_end_time" : "2016-09-30 13:59:50",
"snapshot_cycle" : "manual",
"snapshot_status" : "deleted",
"snapshot_size" : 1.5,
"snapshot_url" : "",
"snapshot_url_expires" : 1483728440
},
"1" : {
"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 version="1.0" encoding="utf-8"?>
<code>OK</code>
<message></message>
<data>
<total_records>100</total_records>
<records_per_page>20</records_per_page>
<total_pages>5</total_pages>
<page>1</page>
<records>
<record>
<snapshot_id>adhjgahdad</snapshot_id>
<server_id>12345</server_id>
<server_label>My Server One</server_label>
<snapshot_name>gashgajshgjahsdad.disk</snapshot_name>
<snapshot_add_time>2016-09-20 00:00:12</snapshot_add_time>
<snapshot_end_time>2016-09-30 13:59:50</snapshot_end_time>
<snapshot_cycle>manual</snapshot_cycle>
<snapshot_status>deleted</snapshot_status>
<snapshot_size>1.5</snapshot_size>
<snapshot_url></snapshot_url>
<snapshot_url_expires>1483728440</snapshot_url_expires>
</record>
<record>
<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>
</record>
................................
}
</records>
</data>
<?php
$url = "https://virtdedi.com/api-sandbox/v1/get_snapshot_list";
//$url = "https://virtdedi.com/api/v1/get_snapshot_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,
"client_ip_address" => "103.219.248.10",
"records_per_page" => 30,
"page" => 1,
"sorted_by" => "snapshot_size_descending"
);
$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
}
}
}