无法使用SoftLayer API创建虚拟IP

时间:2015-12-22 22:13:01

标签: api rest ibm-cloud-infrastructure

当使用API​​为VIP下订单时,它会因非直观的错误消息而失败。请参阅以下REST API调用JSON以及随后出现的错误:

JSON:
{
  "loadBalancer": {
    "name": "lbName_TEST",
    "id" : 123, 
    "type": "HTTP",
    "sourcePort": 80,
    "virtualIpAddress": "123.123.123.123"
  }
}

REST API URL USED:
https://user.name:longid4235234532@api.softlayer.com/rest/v3/SoftLayer_Network_Application_Delivery_Controller/15293/createLiveLoadBalancer.json

{
  "error": "Invalid port supplied.",
  "code": "SoftLayer_Exception_Public"
}

出现的问题是这个。我们正在尝试编写VPX Netscaler的排序脚本并将所有相关配置添加到创建的VPX中,我们是否在做了一些无序的事情?

2 个答案:

答案 0 :(得分:0)

要订购设备或服务,您需要使用SoftLayer_Product_Order :: placeOrder方法。这里有一个订购NetScaler的例子

URL: https://api.softlayer.com/rest/v3/SoftLayer_Product_Order/placeOrder

Method: POST

PAYLOAD: {
    "parameters": [
        {
            "packageId": 192,
            "location": 265592,  
            "prices": [
                {
                    "id": 22315,
                    "complexType": "SoftLayer_Product_Item_Price"
                },
                {
                    "id": 17238,
                    "complexType": "SoftLayer_Product_Item_Price"
                }
            ],
            "complexType": "SoftLayer_Container_Product_Order_Network_Application_Delivery_Controller"
        }
    ]
}

价格22315用于“Citrix NetScaler VPX 10.1 10Mbps标准”,17238用于“2个静态公共IP地址” 要获得所有价格,请使用http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getItems方法

答案 1 :(得分:0)

与创建loadBalancer相关的JSON是错误的,试试这个JSON:

{
"parameters": [
    {
         "name": "lbName_TEST",
         "type": "HTTP",
         "sourcePort": 80,
         "virtualIpAddress": "123.123.123.123",
         "loadBalancingMethod": "pi"
    }
]

}

此致