AddNewDisk Print

  • API
  • 0

Adds another disk onto your server mentioned on serviceid. When you call this method, you must understand that that your credit will be reduced by the amount the addon costs. One addon of variable quantity can be bought per API call.

Request Parameters

Parameter Type Description Required
action string “AddNewDisk” Required
serviceid string The service id code as per your Sive.Host client area. When you login to Sive.Host client area, you click on the active services, a list of all will appear, then click on the word "Active" next to the service, then the service page will appear, on the url of the page, you will see the number at the end of it. eg. if URL is https://sive.host/clientarea.php?action=productdetails&id=2633 , then the service id is 2633 in this case. Required
api_key string API key credentials as per Authentication instructions Required
api_secret string API secret credentials as per Authentication instructions Required
addonid string The Addon id code as per Virtual Machine Addon codes page. eg. 144 Required
addonidqty string The number of units you want to add as per addonid. eg. 1 would indicate adding a disk with size 5GB if addonid is 144. Required
disk string The disk type without the number, just the bus only. eg. scsi for the secondary VM disk or mp for container secondary disk. Without the number. Required
mountpoint string This is the mount point inside the server. Required for LXC or CT container Required

Response Parameters

Parameter Type Description
result string The result of the operation: success or error
status string The status of the invoice generated for the additional capacity.
serviceid string The Service ID created by the succesful purchase.
invoiceid int The Invoice ID created by the succesful purchase.
message string Additional information regarding the resize operation

Example Request (CURL)

<?php

$apiUrl = 'https://sive.host/includes/sivehost-api.php'; // Change to your API endpoint
$username = 'Ikhaka'; // required
$password = 'Mph#th9mi$'; // required

$postfields = array(
    'api_key' => 'G2dskdXb7BlDwlvbrD1zVEe5ZKQIybXn', // required 
    'api_secret' => 'CtIJVZf8OM1p4iLxwiKFjlU4bPVmEycS', // required
    'action' => 'AddNewDisk',
    'serviceid' => '2639',
    'addonid' => '144', //as virtual machine addon codes
    'addonidqty' => '1', //1 in this case is one unit is 5GB
    'disk' => 'scsi1',    //as per disk codes
    'mountpoint' => '/home/HugeFiles',    //as per disk codes
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); // Basic Authentication
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Use true in production with a valid SSL

$response = curl_exec($ch);

// Check for cURL errors
if (curl_errno($ch)) {
    echo 'cURL Error: ' . curl_error($ch);
}
    
curl_close($ch);

// Output response
echo $response;
?>

Example Response JSON

{
"result":"success",
"status":"Unpaid",
"serviceid":"2639",
"invoiceid":13784,
"message":{"data":"UPID:ekhaya101:001D4AEA:17CB6F38:67B498A3:resize:112:africanlab@pve:"}
}

Error Responses

Error Message Cause
Unauthorized access! Request from unauthorized IP
Invalid API Key or secret. Incorrect API credentials
Invalid Product or Operating System. Unknown product or Operating System for that product
Missing action parameter. action not specified eg. BuyNow
Insufficient credit to place the order. Not enough account balance. Load credit on Sive.Host client area.
Invalid Payment Method. Valid options include Payment method not specified on payload.
Invalid disk format. Incorrect disk format eg. putting rootfs for VPS instead of scsi0, or scsi0 for LXC instead of rootfs

Version History

Version Changelog
1.0 Initial Version

Was this answer helpful?
Back