错误在于商品的价格。
下面是一个例子,如何通过rest api下一个块存储订单。
方法:POST
https://[用户名]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Order/verifyOrder
身体:Json
{
"parameters": [
{
"complexType": "SoftLayer_Container_Product_Order_Network_Storage_AsAService",
"location": 265592,
"packageId": 759,
"prices": [
{
"id": 189433
},
{
"id": 189443
},
{
"id": 189833
},
{
"id": 189893
}
],
"quantity": 1,
"iops": 3000,
"osFormatType":{
"id": 24,
"keyName": "WINDOWS_2008"
},
"volumeSize": 250
}
] }
• 这是商品价格的类别代码和描述:
"id": 189433 (categoryCode: storage_as_a_service, "description": "Storage as a Service")
"id": 189443 (categoryCode: storage_block, "description": "Block Storage")
“id”:189833(categoryCode:performance_storage_space,“description”:“100 - 499 GBs”)
“id”:189893(categoryCode:performance_storage_iops,“description”:“100 - 6000 IOPS”)
• 您可以通过“描述”值在此 api 中搜索商品价格的 id:
方法:获取
https://[用户名]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/759/getItemPrices?objectMask=mask[id,locationGroupId,item[id,keyName,description],pricingLocationGroup[locations [id,name,longName]]]
例如“描述”:“存储即服务”
{
"id": 189433,
"locationGroupId": null,
"item": {
"description": "Storage as a Service",
"id": 9571,
"keyName": "STORAGE_AS_A_SERVICE"
}
}
例如“描述”:“100 - 499 GBs”你会发现相同的选项,但你必须选择取决于你想要的位置。
在我的示例中,我选择了“Amsterdam 1”,“id”将是“id”:189833
{
"id": 189833,
"locationGroupId": 503,
"item": {
"description": "100 - 499 GBs",
"id": 9585,
"keyName": "100_499_GBS"
},
"pricingLocationGroup": {
"description": "Location Group 2",
"id": 503,
"locationGroupTypeId": 82,
"name": "Location Group 2",
"securityLevelId": null,
"locations": [
{
"id": 449610,
"longName": "Montreal 1",
"name": "mon01"
},
{
"id": 449618,
"longName": "Montreal 2",
"name": "mon02"
},
{
"id": 448994,
"longName": "Toronto 1",
"name": "tor01"
},
{
"id": 350993,
"longName": "Toronto 2",
"name": "tor02"
},
{
"id": 221894,
"longName": "Amsterdam 2",
"name": "ams02"
},
{
"id": 265592,
"longName": "Amsterdam 1",
"name": "ams01"
},
{
"id": 814994,
"longName": "Amsterdam 3",
"name": "ams03"
}
]
}
},
其余商品价格相同。