问题
background
Use sl_product_order.placeOrder api to order a vsi. Order params:
{'prices': [{'id': 1644}, {'id': 1640}, {'id': 2202}, {'id': 272}, {'id': 45466}, {'id': 905}, {'id': 21}, {'id': 57}, {'id': 55}, {'id': 58}, {'id': 420}, {'id': 418}, {'id': 17129}, {'id': 1800}], 'location': '224092', 'packageId': 835, 'complexType': 'SoftLayer_Container_Product_Order_Virtual_Guest', 'useHourlyPricing': True, 'virtualGuests': [{'domain': 'xxx.com', 'hostname': 'xxx-rkgw77q5'}], 'quantity': 1}
'dataCenter': 'sng01' id:224092
exception
SoftLayerAPIError(SoftLayer_Exception_Order_InvalidLocation): The location provided for this order is invalid.
question
Yesterday, this api works ok for create a vsi with the same params. But, now it does not works.
I can buy vsi of sng01 in portal website. But the api always tells The location provided for this order is invalid.
回答1:
Before ordering you need to make sure that the package that you are going to use works for the location that you want to use, to check that you must run this method:
http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getRegions
Currently the package that you are using does not have the location sng01 as valid that's why you are getting the error.
In another hand you are able to order in that region using the control portal because the control portal uses another package for virtuall servers, it is using the package 46, So you need to change the package in your order and maybe the prices as well because each package has its own prices.
来源:https://stackoverflow.com/questions/45031137/softlayer-api-exception-the-location-provided-for-this-order-is-invalid