I want to order an hourly Bare Metal, using Softlayer java API. I took the idea from https://gist.github.com/bmpotter/fe2de7f8028d73ada4e5. Here are my steps:
Hardware hardware = new Hardware();
Order orderTemplate = new Order();
// 1. Set hostname, domain to hardware
// 2. set Preset
Preset preset = new Preset();
preset.setKeyName("S1270_8GB_2X1TBSATA_NORAID");
hardware.setFixedConfigurationPreset(preset);
// 3. Component setMaxSpeed, and added to hardware
hardware.setPrimaryNetworkComponent()
// 4. "UBUNTU_14_64"
hardware.setOperatingSystemReferenceCode()
// 1. Added Quantity to orderTemplate
// 2. Added location to orderTemplate
// 3. Added Hardware to orderTemplate
// 4. Added Container, since I am see the exception
orderTemplate.setContainerIdentifier("SoftLayer_Product_Package_Preset");
Finally tried to verify the Order.
I keep getting a generic error message:
Invalid container specified: SoftLayer_Container_Product_Order. Ordering a server or service requires a specific container type, not the generic base order container.
What am I doing wrong? Do I need to send priceIds
, similar to non hourly Bare Metal Order? Is there a troubleshooting guide to know what is missing in my order?
Pedro David Fuentes Can you please help? I tried this, after figuring out the prices:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Product_Order/verifyOrder
{
"parameters": [
{
"complexType": "SoftLayer_Container_Product_Order_Hardware_Server",
"quantity": 1,
"location": "DALLAS",
"packageId": 200,
"useHourlyPricing": 1,
"presetId": 66,
"prices": [
{
"id": 37318
},
{
"id": 34183
},
{
"id": 26737
},
{
"id": 34807
},
{
"id": 25014
}
],
"hardware": [
{
"hostname": "myhostname",
"domain": "mydomain.com"
}
]
}
]
}
{
"error": "Unable to add a Graphics Processing Unit price (178119) because it is not valid for the package (200).",
"code": "SoftLayer_Exception_Public"
}
Also reproducible via JAVA code, hence tried via REST too.
Modified code with extra logging:
String username = "xxxxx";
String apiKey = "xxxxx";
Location datacenter = new Location();
datacenter.setName("seo01");
Preset preset = new Preset();
preset.setKeyName("S1270_8GB_2X1TBSATA_NORAID");
Component networkComponent = new Component();
networkComponent.setMaxSpeed(100L);
Hardware hardware = new Hardware();
hardware.setDatacenter(datacenter);
hardware.setHostname("xxxxx_xxxxx_BM_HOURLY");
hardware.setDomain("xxxx.xxx");
hardware.setHourlyBillingFlag(true);
hardware.setFixedConfigurationPreset(preset);
List<Component> networkComponents = hardware.getNetworkComponents();
networkComponents.add(networkComponent);
hardware.setOperatingSystemReferenceCode("CENTOS_LATEST");
ApiClient client = new RestApiClient().withCredentials(username, apiKey).withLoggingEnabled();
Hardware.Service hardwareService = Hardware.service(client);
try
{
Gson gson = new Gson();
Hardware hardwarePlaced = hardwareService.createObject(hardware);
System.out.println("createObject: " + gson.toJson(hardwarePlaced));
}
catch(Exception e)
{
System.out.println("Error: " + e);
}
I get an error: Running POST on link with body: {"parameters":[{"complexType":"SoftLayer_Hardware","hostname":"xxxxx_xxxxx_BM_HOURLY","domain":"xxxx.xxx","fixedConfigurationPreset":{"complexType":"SoftLayer_Product_Package_Preset","keyName":"S1270_8GB_2X1TBSATA_NORAID"},"datacenter":{"complexType":"SoftLayer_Location","name":"seo01"},"hourlyBillingFlag":true,"networkComponents":[{"complexType":"SoftLayer_Network_Component","maxSpeed":100}],"operatingSystemReferenceCode":"CENTOS_LATEST"}]} Got 500 on link with body: {"error":"Unable to add a Graphics Processing Unit price (178119) because it is not valid for the package (200).","code":"SoftLayer_Exception_Public"} Error: com.softlayer.api.ApiException$Internal: Unable to add a Graphics Processing Unit price (178119) because it is not valid for the package (200).(code: SoftLayer_Exception_Public, status: 500)