REST API request that will give the same result as

2019-08-08 17:55发布

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.

1条回答
Luminary・发光体
2楼-- · 2019-08-08 18:33

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)"?

查看更多
登录 后发表回答