问题描述
我正在尝试使用Softlayer Python客户端在Softlayer中订购虚拟服务器.我的订单json看起来像这样:
I am trying to order a virtual server in Softlayer using the Softlayer Python client. My order json looks like this:
order = {
'complexType': 'SoftLayer_Container_Product_Order_Virtual_Guest',
'quantity': 1,
'virtualGuests': [
{
'hostname': 'test',
'domain': 'example.com',
'primaryBackendNetworkComponent': {
'networkVlan': {
'id': 752950
}
}
}
],
'location': 142775,
'packageId': 46,
'useHourlyPricing': True,
'prices': [
{'id': 112863}, # 2 x 2.0 GHz Core
{'id': 153861}, # 1 GB RAM
{'id': 23070}, # Reboot / Remote Console
{'id': 155153}, # 1 Gbps Public & Private Networks
{'id': 164857}, # 1000 GB Bandwidth
{'id': 34807}, # 1 IP Address
{'id': 24013}, # 25 GB (SAN)
{'id': 23820}, # OS_WINDOWS_2012_FULL_STD_64_BIT
{'id': 27023}, # Host Ping Monitoring
{'id': 32500}, # Email and Ticket Notifications
{'id': 32627}, # Automated Notification Response
{'id': 33483}, # Unlimited SSL VPN Users & 1 PPTP VPN User per account
{'id': 36536} # VMWARE VCenter addon
]
}
在实际下达订单之前,我先进行了验证:
I verify the order before actually placing it:
client['Product_Order'].verifyOrder(order)
但是我一直收到以下错误消息: 2 x 2.0 GHz内核(#112863)的价格不适用于位置hou02.我尝试了所有其他位置,但始终获得同样的错误信息.你知道我能解决这个问题吗?
But I keep getting this error message: The price for 2 x 2.0 GHz Cores (#112863) is not valid for location hou02. I have tried all the other locations, but I keep getting the same error message. Do you know I can I resolve this?
推荐答案
您需要选择其他商品的价格ID,该ID位于您使用的位置/数据中心中.
You need to choose other item price id which is located in the Location/Datacenter that you are using.
要根据位置获取有效的商品价格ID,您可以执行以下操作:
To get valid item price ids according to locations, you can execute:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Product_Package/46/getItemPrices?objectMask=mask[id,locationGroupId,item[keyName,description],pricingLocationGroup[locations[id, name, longName]]]
方法: GET
注意::具有locationGroupId = null的价格ID被视为标准价格",API会在内部为客户切换价格.但是我们建议先执行verifyOrder,以查看所需的订单是否正常(费用可能会有所不同).
Note: A price id with a locationGroupId = null is considered "A standard price" and the API will internally switch the prices for the customer. But we recommend to execute first the verifyOrder in order to see if the wanted order is ok (the fee can vary).
此外,以下请求可以帮助您根据特定的位置/数据中心获得有效的商品价格(只需在先前的请求中添加一些过滤器即可):
Additionally, the following request can help you to get valid item prices according to a specific Location/Datacenter (Just adding some filters to the previous request):
-
根据特定套餐提供可用位置的价格列表:
List of prices with available locations according to a specific package:
https://[用户名]:[apikey] @ api.softlayer.com/rest/v3/SoftLayer_Product_Package/[package_id]/getItemPrices?objectMask = mask [id, item.description,hourlyRecurringFee,locationGroupId,pricingLocationGroup [locations [id ,name,longName]]]& objectFilter = {"itemPrices":{"pricingLocationGroup":{"locations":{"id":{操作:" 814994}}}}
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Product_Package/[package_id]/getItemPrices?objectMask=mask[id,item.description,hourlyRecurringFee,locationGroupId,pricingLocationGroup[locations[id, name, longName]]]&objectFilter={"itemPrices":{"pricingLocationGroup":{"locations":{"id":{"operation":"814994"}}}}}
位置:"814994"是阿姆斯特丹3"
Where: "814994" is "Amsterdam 3"
方法: GET
-
此外,列出具有可用位置的软件包:
Also, to list packages with available locations:
这篇关于Softlayer API验证订单失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!