I need to implement placing order for endurance storage in my Application using BPM over ICO (IBM Cloud Orchestrator). We needed following parameters
for creating rest call for placing order:
- Package to use
- Storage Type
- Location
- Storage Package
- Storage Size
- Snapshot Space Size
- OS Type
I am able to fetch data till storage size on the basis of selected storage type, location and storage package using below call:
https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Package/240/getItemPrices?objectMask=mask[id,item[keyName,description],pricingLocationGroup[locations[id, name, longName]]]&objectFilter={"items":{"prices":{"pricingLocationGroup":{"locations":{"item":{"operation":"che01"}}}}}}
But don't have any idea how to get the snapshot space size. What will be the method or API for fetching snapshot space size?
The method to fetch snapshot space size is the SoftLayer_Product_Package::getItemPrices, it returns all the prices in the package see documentation.
The reason you don't see the snaspshot spaces is because the package you are using does not have that kind of items (or categories). You can see the kind of items that the package has using this RestFul
GET https://api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/222/getConfiguration?objectMask=mask[itemCategory]
See documentation for more details
SO you have to use another package, the package for endurance storage is 240, you can see that using this RestFUl:
Get https://api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/getAllObjects
See documentation for more details
As you will notice the items listed by the SoftLayer_Product_Package::getItemPrices contains a property called category, you can use this property to filter the data (See documentation for more detail).
So in order to get only the snapshot space size use this:
GET https://api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/240/getItemPrices?objectFilter={"itemPrices": {"categories": {"categoryCode": {"operation": "storage_snapshot_space"}}}}
see documentation for more details
Also the filter you are using does not work, it is not possible to filter the location using the name (I do not know why, but it is working like that),
currently your request is fetching all the data ignoring the filter, you need to filter the locations using the "locationGroupId" see documentation for more details
Here a simple example to fetch the item prices for the location "che01"
GET https://api.softlayer.com/rest/v3/SoftLayer_Product_Package/240/getItemPrices?objectFilter={"itemPrices": {"locationGroupId": {"operation": "in", "options": [{"name": "data", "value": [585,583]}]}}}
You may asking yourself how to get the values 585 and 583, weel see documentation for that.
here an example to get those values
GET https://api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/240/getRegions?objectMask=mask[location[location[priceGroups]]]
Now you can mix the filters to get all snapshot sapace size for a location like this:
GET https://api.softlayer.com/rest/v3/SoftLayer_Product_Package/240/getItemPrices?objectFilter={"itemPrices": { "categories": {"categoryCode": {"operation": "storage_snapshot_space"}} , "locationGroupId": {"operation": "in", "options": [{"name": "data", "value": [585,583]}]}}}
I hope this help you and you do not need ask more times about the same, but if you have more question please see documentation there are plenty of good information about orders and other stuff http://sldn.softlayer.com/
Regards