Can I specify bandwidth to soft layer API for crea

2019-09-10 10:38发布

问题:

I am trying to create a virtual server through soft layer API. But the API I came across don't seem to accept network bandwidth, can't I specify the required bandwidth for my virtual server created through API?

Thanks, Kishore

回答1:

Anyway, here an example using SoftLayer_Product_Order::placeOrder method to place an order for VSI with bandwidth:

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Order/verifyOrder

Method: Post

{  
   "parameters":[  
      {  
         "location":449494,
         "packageId":46,
         "hardware":[  
            {  
               "domain":"softlayer.com",
               "hostname":"test"
            }
         ],
         "prices":[  
            {  
               "id":1640
            },
            {  
               "id":1644
            },
            {  
               "id":13940
            },
            {  
               "id":2202
            },
            {  
               "id":50241
            },
            {  
               "id":273
            },
            {  
               "id":2302
            },
            {  
               "id":55
            },
            {  
               "id":58
            },
            {  
               "id":420
            },
            {  
               "id":418
            },
            {  
               "id":21
            },
            {  
               "id":57
            },
            {  
               "id":905
            },
            {  
               "id":14022
            }
         ]
      }
   ]
}

The "50241" price refers to "5000 GB Bandwidth"

To retrieve information about item prices, try this:

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Package/46/getItemPrices

Method: Get

References:

SoftLayer_Product_Package::getItemPrices