Softlayer API验证订单fai

2024-06-16 08:52:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图订购一个虚拟服务器在软层使用软层Python客户端。我的订单json如下所示:

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
]
}

我在下订单之前先核实一下:

^{pr2}$

但我一直收到这样的错误消息:2 x 2.0 GHz核心(#112863)的价格对位置hou02无效。我尝试过所有其他位置,但始终收到相同的错误消息。你知道我能解决这个问题吗?在


Tags: 订单服务器idjson消息客户端container错误
1条回答
网友
1楼 · 发布于 2024-06-16 08:52:24

您需要选择位于您使用的位置/数据中心的其他项目价格id。在

要根据位置获取有效的项目价格ID,可以执行:

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]]]

方法:获取

注意:locationGroupId=null的价格id被视为“标准价格”,API将在内部为客户切换价格。但我们建议先执行verifyOrder,以查看所需订单是否正常(费用可能会有所不同)。在

此外,以下请求可以帮助您根据特定位置/数据中心获取有效的项目价格(只需在上一个请求中添加一些筛选器):

其中:“814994”是“阿姆斯特丹3号”

方法:获取

相关问题 更多 >