1

I am having trouble understanding how to form a REST API request to order block storage identical to what I order through the web-based control interface.

I have ordered a "Performance" storage type disk, in the ams01 location, with monthly billing, that is 100GB with 300 IOPS.

I fail to understand which service I should use - and if it is the place_order service - how I should properly make this REST API request. A practical example using the values above would be very helpful.

Ludvig A. Norin
  • 5,115
  • 7
  • 30
  • 34

1 Answers1

2

You can use the following REST request to order performance block storage in Amsterdam, with 100 Gb, 300 Iops, by default it is monthly ordered, but if you want to order hourly, you need to add the parameter "useHourlyPricing" = true

https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Product_Order/verifyOrder

method: POST
json body:

{
"parameters": [{
   
        "complexType": "SoftLayer_Container_Product_Order_Network_Storage_AsAService",
        "location": 265592,
        "packageId": 759,
        "volumeSize": 100,
        "iops": 300,
        "prices": [{
            "id": 189433
        }, {
            "id": 189443
        }, {
            "id": 189893
        }, {
            "id": 189833
        }],

        "osFormatType": {
            "keyName": "LINUX"
        }
    }]
}

Remember to change [username] and [apiKey] values for valid credentials, and change the method verifyOrder by placeOrder when you are ready to order.

The item prices you are seeing above have the following descriptions:

  • "Storage as a Service"

  • "Block Storage"

  • "100 - 6000 IOPS"

  • "100 - 499 GBS"

For more information about iops and capacity for block storage volumes you may see this:

SoftLayer Object Storage API: Creation of 250GB/500GB Block Storage failure. 20GB or 1000GB are OK


To retrieve valid property values for your orders, try the following request to obtain valid item prices:

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

Or you may go further by using Object Masks along with it to retrieve item prices by their available location.

 https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/759/getItemPrices?objectMask=mask[id,locationGroupId,item[id,keyName,description],pricingLocationGroup[locations[id, name, longName]]]

Note: You can also order endurance block storage using the package 759, the structure is similar as above, the difference is that you need to remove iops parameter and change for valid item prices for endurance storage.


Former way

The following rest request is to order a Performance block storage using the valid structure which is still used for some api users and it's still valid via Api, on this case the package id you need to use is 222 as following:

{
"parameters": [{
   
        "complexType": "SoftLayer_Container_Product_Order_Network_PerformanceStorage_Iscsi",
        "location": "DALLAS09",
        "packageId": 222,
        "prices": [
                        {
            "id": 40672
            }, 
                        {
            "id": 40682
            }, 
                        {
            "id": 40792
            }
                        ],

        "osFormatType": {
            "keyName": "LINUX"
        }
    }]
}

The item prices you are seeing above have the following descriptions:

  • Block Storage Performance (ISCSI)

  • 20 GB Storage Space

  • 100 IOPS


You can also review the following links:

osFormatType Endurance Block Storage ordering Softlayer

How can we order "Storage As A Service (StaaS)"?

Community
  • 1
  • 1
Fernando Iquiza
  • 531
  • 3
  • 7
  • How do I list all packages? I can't find the 759 package when doing "SoftLayer_Product_Package_Type/getAllObjects.json". – Ludvig A. Norin Sep 13 '17 at 07:53
  • 1
    The service you need to use is not Product_Package_Type, what you require to use in order to get the packages and find 759 is to use the service SoftLayer_Product_Package/getAllObjects. – Fernando Iquiza Sep 13 '17 at 13:51
  • Is the price id 189833 location-specific or can it be used in all locations? The list of prices contain many items "100_499_GBS", but I have no idea which should be chosen and why, please advise – Ludvig A. Norin Sep 18 '17 at 22:38
  • That price is for a location-specific, but if you see response for previous rest request using masks, you'll see that there are some item prices with "locationGroupId" property as "null" or just empty (" "), these will work on any datacenter. Regarding to this description for 100 GBs, if you use the object masks you'll notest several item prices, this is because it has narrowed them by their specific location ("id" value) , or if they are standard prices (mentioned above for locationGroupId) be displayed as well. – Fernando Iquiza Sep 19 '17 at 23:49
  • Try this improved rest request https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/759/getItemPrices?objectMask=mask[id,locationGroupId,item[id,keyName,description],pricingLocationGroup[locations[id, name, longName]]] It will display the names of the specific locations available for each locationGroupId as mentioned previously, but as you can see in the response those with a null value will not have any locations, this is because they are Standard prices as mentioned above (e.g 189833 item price belongs to locationGroupId 503 which has specific locations). – Fernando Iquiza Sep 19 '17 at 23:57