0
votes

I’m trying to get information about prices for virtual servers from Softlayer API with this python code:

client['Product_Package'].getItems(id=835)

received results I’m trying to use to recreate offers of flavors which can be found on this web page: https://www.softlayer.com/cloud-computing/bluemix/Store/orderComputingInstance?language=en&cm_mc_uid=06493590598515064371141&cm_mc_sid_50200000=1506586953&cm_mc_sid_52640000=1506586953

base on web page I noticed that there are a few groups of flavors (Balanced, Balanced Local Storage, Balanced Local Storage SSD, Compute, Memory) and each of them have some special rules for marching cpu with ram and hard drives.

Unfortunately I do not find this logic (for matching cpu with ram and hard drives) in offers from Softlayer API. Yes there is keyName property in ram offers which contains words ‘Balanced’, ‘Memory’, ‘HDD’ and CPUs names but it is not enough to recreate full offers from web page. For example I’m missing information which CPU to use in Balanced Local Storage flavor, which hard drives are allowed for which flavors, sometimes ram offers without any special name in keyName property (I though they should be used only for Compute flavor) are used for different flavors.

Which results are correct? On the web page or from API?

How can I get the logic for matching ingredients of flavors?

1

1 Answers

0
votes

the easy way to order those flavors is just using the method:

http://sldn.softlayer.com/reference/services/softlayer_virtual_guest/createObject

you just need to set up the flavor that you want, you can see all the available flavors using the method:

http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/getCreateObjectOptions

here you can see an example about that:

Softlayer API send SSD disk information?

Now, if you want to use the placeOrder method, in order to get the flavors you need to call the method:

http://sldn.softlayer.com/reference/services/softlayer_product_package/getactivepresets

the method will return the flavors for the package that you want, then in your order you need to set up that presetId see http://sldn.softlayer.com/reference/datatypes/SoftLayer_Container_Product_Order_Virtual_Guest for more information, basically you should only add this property in your order:

presetId

A preset configuration id for the package. Is required if not submitting any prices. Type: integer

As the flavor (or Preset) already has the configuration for some items such as CPU, RAM or disks you do not need to add those prices in your order.