0

I am investigating a method using REST API to obtain valid objects I can use on a create of a VSI or Bare Metal in a specific datacenters. Information needed: 1. Private network speed 10Gbs or 1Gbs 2. Machine types supported, if a vGPU is supported is machine type a V100 or P100.

Can you help me with some guidance on methods to use and how to filter by datacenter? Thanks.

old_timer
  • 69,149
  • 8
  • 89
  • 168

1 Answers1

1

If you wish to retrieve items from a specific datecenter, you can to use SoftLayer_Product_Package::getItemPrices, for example, the rest API call below retrieves all network speed items greater than 1000 Mbps in ams01 for the VSI package Id (eg. 835 "PUBLIC_CLOUD_SERVER"):

Method: GET

https://username:apikey@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/835/getItemPrices?objectMask=mask[id,item,pricingLocationGroup[locations[name]]]&objectFilter={"itemPrices":{"pricingLocationGroup":{"locations":{"name":{"operation":"ams01"}}},"item":{"itemCategory":{"categoryCode":{"operation":"port_speed"}},"capacity":{"operation":">=1000"}}}}

You can use a bare metal package Id (eg. 200 "BARE_METAL_SERVER"), in order to retrieve items for Bare Metal. Also, I suggest you use standard prices and use them with any datacenter.

Method: GET

https://username:apikey@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/200/getItemPrices?objectMask=mask[id,locationGroupId,item[itemCategory],pricingLocationGroup[locations[name]]]&objectFilter={"itemPrices":{"locationGroupId":{"operation":"is null"},"item":{"itemCategory":{"categoryCode":{"operation":"port_speed"}},"capacity":{"operation":">=1000"}}}}

Keep in mind that the API call above, retrieves standard prices for bare metal, and if you wish to get standard prices for VSI you will have to use a package Id for VSI.

References:

https://sldn.softlayer.com/article/understanding-ordering/ https://sldn.softlayer.com/python/ordering_slcli/

  • Is the VSI package id 835 or Bare Metak Sever package id 200 the same accross all datacenters? – Gary Sutherland Jul 15 '19 at 18:31
  • Yes, but keep in mind that the hardware is subject to availability, and this could vary in regions. – german eduardo Jul 15 '19 at 19:48
  • I just tried this URL https://api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/200/getItemPrices?objectMask=mask[id,item,pricingLocationGroup[locations[name]]]&objectFilter={"itemPrices":{"pricingLocationGroup":{"locations":{"name":{"operation":"wdc07"}}}}} and it returned a content of [] I get the same thing usig package number 835. – Gary Sutherland Jul 15 '19 at 20:40
  • for wdc locations, the item prices are standard, it means that you can use the item prices where locationGroupId is null. – german eduardo Jul 18 '19 at 21:37