How to get the proper list of SoftLayer datacenter

2019-07-09 01:58发布

问题:

I'm building an application for ordering hardware and I've seen that I can't get the same list of available datacenters for a given package id. I'm currently using getRegions() which it is supposed to return the list of datacenter where the given package is available. However, I have seen that it differs from what I can see in the SoftLayer portal. For instance, for the package 253, I get 28 datacenters. However, if I try to place and order manually from the SL portal, those 28 are not present (just a subset of them).

I imagined that I had to query something else like isAvailable or deliveryTimeInformation. isAvailable looks to be 1 in all cases and I can't get a value for deliveryTimeInformation other than an empty list.

My question is: is there any way to get the same datacenter list you guys show in the SL portal using the API?

回答1:

The method that you’re using is correct, but you have to consider that different packages might have the same product item names, whereas one might be a monthly package and another one an hourly package.

Make sure you're viewing the correct item and package through UI. You could verify this clicking a price in the UI list and checking if it correctly redirects you to a URL that contains a 253 number.

Furthermore, package 253 is allowed in 27 data centers, you can verify using the next request:

https://$username:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Package_Server/getAllObjects.json?objectFilter={"packageId":{"operation":253}}

The next request could help you to verify that the processorName “Intel Xeon E5-2650 v3” is contained in more than a single package, one of them is the 253.

https://$username:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Package_Server/getAllObjects.json?objectFilter={"processorName":{"operation":"Intel Xeon E5-2650 v3"}}

Additionally this link might help you as well:

http://sldn.softlayer.com/blog/cmporter/Location-based-Pricing-and-You