如何获取软层 packageId 列表(全部)及其详细信息

How get a list of softlayer packageId (all) and their detail

我想检索软层 packageId 列表及其详细信息。

我需要在脚本中使用 packageId 来配置服务器。所以,我需要知道价格,数据包中的组件(CPU、RAM、NIC 等)。

要获取软层 packageId 列表及其详细信息,您可以使用此 rest api:

方法:获取

https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/getAllObjects

参考: https://softlayer.github.io/reference/services/SoftLayer_Product_Package/getAllObjects/

要获取商品价格及其各自的位置,您可以使用以下其余部分 api:

方法:获取

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]]]

您将在响应中找到创建服务器所需的所有商品价格,例如 cpu、内存等

您必须 select 同一地点的商品价格。没有位置的项目是标准的,这意味着该项目的所有位置都可用。

参考:

https://softlayer.github.io/reference/services/SoftLayer_Product_Package/getItemPrices/

下面是另一个如何获取所有包列表和所需项目的示例: https://softlayer.github.io/python/list_packages/ https://softlayer.github.io/python/get_required_price_id/