I like to retrieve a list of softlayer packageId and their details.
I need to use packageId in my script to provision server. So, I need to know the price, what components (CPU, RAM, NIC, and etc.) in a packet.
To get the list of softlayer packageId and their details you can use this rest api:
Method: GET
https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/getAllObjects
Reference: https://softlayer.github.io/reference/services/SoftLayer_Product_Package/getAllObjects/
To get the item prices and their respective locations you can use the following rest api:
Method: GET
https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/[packageId]/getItemPrices?objectMask=mask[id,locationGroupId,item[id,keyName,description],pricingLocationGroup[locations[id, name, longName]]]
You will find in the response all the item prices that you need to create your server such as cpu, ram, etc.
You have to select the item prices for the same location. The item that does not have locations are standards, it means all locations are available for that item.
Reference:
https://softlayer.github.io/reference/services/SoftLayer_Product_Package/getItemPrices/
Bellow there are another examples how to get the all packages list and the items required: https://softlayer.github.io/python/list_packages/ https://softlayer.github.io/python/get_required_price_id/