Using SoftLayer API, I've ordered an Endurance Block Storage and it's there.
Now I am trying to write a PHP code that will use SoftLayer API to modify Snapshot space, but I keep getting this error:
There was an error querying the SoftLayer API: Price does not have an id.
And I am not sure what the issue is.
Below is bit of code that I am using to do this:
$clientServer = SoftLayer_XmlrpcClient::getClient('SoftLayer_Product_Order', null, userID, apiKey);
$clientServer->verifyOrder($order);
And the $order that I pass is below and the price ID I pass is correct as far as I know. So what am I missing? Or do I need to do this in different way?
{
"categoryCode" : "storage_snapshot_space",
"complexType" : "Container_Product_Order_Network_Storage_Enterprise_SnapshotSpace_Upgrade",
"packageId" : 240,
"prices" : [
{
"id" : 144295
}
],
"properties" : [
{
"name" : "orderOrigin",
"value" : "control"
}
],
"virtualGuests" : null
}
Any help will be appreciated. Thank you.
The Json should be something like this, where the volumeId is the block storage id where the upgrade will be applied.
{
"complexType": "SoftLayer_Container_Product_Order_Network_Storage_Enterprise_SnapshotSpace_Upgrade",
"packageId": 240,
"prices": [{
"id": 144295
}],
"volumeId": 5805095
}
In PHP it would be like this:
<?php
require_once ('C:/scripst/getdetails/SoftLayer/SoapClient.class.php');
$username = 'set me';
$key = 'set me';
$softLayer_product_order = SoftLayer_SoapClient::getClient('SoftLayer_Product_Order', null, $username, $key);
$prices = array
(
46150
);
$orderPrices = array();
foreach ($prices as $priceId){
$price = new stdClass();
$price->id = $priceId;
$orderPrices[] = $price;
}
$packageId = 240;
$volumeId = 5805095;
$orderContainer = new stdClass();
$orderContainer->packageId = $packageId;
$orderContainer->prices = $orderPrices;
$orderContainer->volumeId = $volumeId;
try {
$orderTemplate = new SoapVar
(
$orderContainer,
SOAP_ENC_OBJECT,
'SoftLayer_Container_Product_Order_Network_Storage_Enterprise_SnapshotSpace_Upgrade',
'http://api.service.softlayer.com/soap/v3/'
);
$receipt = $softLayer_product_order->verifyOrder($orderTemplate);
print_r($receipt);
} catch (Exception $e) {
echo 'Unable to place the order: ' . $e->getMessage();
}
Do not forget replace the prices and the volumeID
Regards