JSON 验证无效
JSON validation not working
我正在尝试使用 SoftLayer_Product_Order/<package>/verifyOrder.json
API 来验证我的 JSON 订购一些 Endurance NAS,但对于许多组合。
我不断收到错误消息:
Order is missing the following category: Storage Space
但我似乎提供了有效的存储 Space 类型价格。
价格对象的组合是:
Type: 45064 (Endurance Storage)
IOPS: 45074 (LOW_INTENSITY_TIER)
Storage: 45856 (20 GB Storage Space)
Base Type: 45104 (Block Storage)
JSON:
{ "parameters" : [
{
"location" : "449494",
"packageId" : 240,
"osFormatType" : {
"id" : 12,
"keyName" : "LINUX"
},
"complexType" : "SoftLayer_Container_Product_Order_Network_Storage_Enterprise",
"quantity" : 1,
"prices" : [
{
"id" : "45064"
},
{
"id" : "45074"
},
{
"id" : "45856"
},
{
"id" : "45104"
}
]
}
]
}
REST 调用:
https://api.softlayer.com/rest/v3/SoftLayer_Product_Order/240/verifyOrder.json
响应:
$VAR1 = {
'error' => 'Order is missing the following category: Storage Space.',
'code' => 'SoftLayer_Exception_Order_MissingCategory'
};
不确定我错过了什么。
我认为
的答案
understanding undef locationGroupId entries in package items
帮我回答这个问题。
定义存储价格有误,您发送的是 快照大小而不是块耐久性
- Price: 45856 Category: Storage Snapshot Space
- Price: 45124 Category: Storage Space
因此您需要使用属于 "Storage Space" (45124) 的价格,可以帮助识别它们的请求应该是:
https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Package/240/getItemPrices?objectFilter={"itemPrices":{"categories":{"name":{"operation":"Storage Space"}}}}&objectMask=mask[categories]
Method: Get
请试试这个:
{
"parameters":[
{
"location":"449494",
"packageId":240,
"osFormatType":{
"id":12,
"keyName":"LINUX"
},
"complexType":"SoftLayer_Container_Product_Order_Network_Storage_Enterprise",
"quantity":1,
"prices":[
{
"id":"45064"
},
{
"id":"45074"
},
{
"id":"45124"
},
{
"id":"45104"
}
]
}
]
}
我正在尝试使用 SoftLayer_Product_Order/<package>/verifyOrder.json
API 来验证我的 JSON 订购一些 Endurance NAS,但对于许多组合。
我不断收到错误消息:
Order is missing the following category: Storage Space
但我似乎提供了有效的存储 Space 类型价格。
价格对象的组合是:
Type: 45064 (Endurance Storage)
IOPS: 45074 (LOW_INTENSITY_TIER)
Storage: 45856 (20 GB Storage Space)
Base Type: 45104 (Block Storage)
JSON:
{ "parameters" : [
{
"location" : "449494",
"packageId" : 240,
"osFormatType" : {
"id" : 12,
"keyName" : "LINUX"
},
"complexType" : "SoftLayer_Container_Product_Order_Network_Storage_Enterprise",
"quantity" : 1,
"prices" : [
{
"id" : "45064"
},
{
"id" : "45074"
},
{
"id" : "45856"
},
{
"id" : "45104"
}
]
}
]
}
REST 调用:
https://api.softlayer.com/rest/v3/SoftLayer_Product_Order/240/verifyOrder.json
响应:
$VAR1 = {
'error' => 'Order is missing the following category: Storage Space.',
'code' => 'SoftLayer_Exception_Order_MissingCategory'
};
不确定我错过了什么。
我认为
的答案understanding undef locationGroupId entries in package items
帮我回答这个问题。
定义存储价格有误,您发送的是 快照大小而不是块耐久性
- Price: 45856 Category: Storage Snapshot Space
- Price: 45124 Category: Storage Space
因此您需要使用属于 "Storage Space" (45124) 的价格,可以帮助识别它们的请求应该是:
https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Package/240/getItemPrices?objectFilter={"itemPrices":{"categories":{"name":{"operation":"Storage Space"}}}}&objectMask=mask[categories]
Method: Get
请试试这个:
{
"parameters":[
{
"location":"449494",
"packageId":240,
"osFormatType":{
"id":12,
"keyName":"LINUX"
},
"complexType":"SoftLayer_Container_Product_Order_Network_Storage_Enterprise",
"quantity":1,
"prices":[
{
"id":"45064"
},
{
"id":"45074"
},
{
"id":"45124"
},
{
"id":"45104"
}
]
}
]
}