Softlayer Evault Price Ids

2019-09-04 03:38发布

问题:

I am trying to create an evault backup programmatically using soflayer API. I have everything I need except for how to obtain the price id for the evault backup size we need. How can I do that dynamically, or if its not available, just the list of price ids for evault storage sizes?

Ive already looked in documentation and also contacted support which they suggested SO with Softlayer tag.

回答1:

A quick view, perhaps using an object filter through the server's datacenter could work:

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Package/0/getItemPrices?objectMask=mask[categories, pricingLocationGroup[locations]]&objectFilter={"itemPrices":{"categories":{"categoryCode":{"operation":"evault"}}, "pricingLocationGroup":{"locations":{"name":{"operation":"sao01"}}}}}

Method: Get

Replace: "sao01" with the server's datacenter name that you wish to order an evault. In case that it doesn't return any response

Updated

My apologies, we should know that the prices are based on the locations, see the below article to get more information about it:

  • Location-based Pricing and You

The below rest request, will help you to get standard prices for datacenters based on these kind of prices:

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Package/0/getItemPrices?objectMask=mask[categories, pricingLocationGroup[locations]]&objectFilter={"itemPrices":{"categories":{"categoryCode":{"operation":"evault"}}, "locationGroupId":{"operation":"is null"}}}

Method: Get

Also, I can provide a rest request to identify which datacenter is based on standard or location prices:

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Location/getDatacenters?objectMask=mask[priceGroups]

Method: Get

The standard prices should be applied for the datacenters which don't have "priceGroups" property/information, for the other datacenters (which have priceGroups), you should use the first request that I provided.