how to order SoftLayer_Virtual_ReservedCapacityGro

2020-05-01 05:37发布

问题:

recently, IBM Bluemix releases Reserved Virtual Server(SoftLayer_Virtual_ReservedCapacityGroup).

We checked a relative API.

  • SoftLayer_Virtual_ReservedCapacityGroup
  • SoftLayer_Virtual_ReservedCapacityGroup_Instance
  • SoftLayer_Account::getActiveReservedCapacityAgreements
  • SoftLayer_Virtual_Guest_Status(1009)

And we can't find how to create reserved capacity group.

we are using API(placeorder) for order.

Looking this api, there are containers about each product.

but there is no container about reserved capacity group.

回答1:

To order a SoftLayer_Virtual_ReservedCapacityGroup you can use the following rest api:

Method: POST

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

Replace the [username] and [apiKey] with your credentials.

Body: Json

 {  
   "parameters":[  
      {  
               "complexType":"SoftLayer_Container_Product_Order_Virtual_ReservedCapacity",
               "backendRouterId": 11111,
               "name": "test",
               "packageId":1059,
               "prices":[  
                  {  
                     "id":217601,
                     "categories": [
                            {
                               "categoryCode": "reserved_capacity",
                               "id": 2060,
                               "name": "Reserved Capacity"
                            }
                         ],
                     "item": {
                               "capacity": "12",
                               "description": "B1.4x16 (1 Year Term)",
                               "id": 12293,
                               "keyName": "B1_4X16_1_YEAR_TERM"
                             }
                   }
               ],
               "quantity":1,
               "useHourlyPricing": true
            } 
         ]
     }

Reference: https://softlayer.github.io/reference/datatypes/SoftLayer_Container_Product_Order_Virtual_ReservedCapacity/

To get the available "backendRouterId" you can use the below rest call:

Method: GET

https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Network_Pod/getAllObjects

You will get a response like this example:

{
    "backendRouterId": 11111,
    "backendRouterName": "bcr01a.dal13",
    "datacenterId": 1854895,
    "datacenterLongName": "Dallas 13",
    "datacenterName": "dal13",
    "frontendRouterId": 22222,
    "frontendRouterName": "fcr01a.dal13",
    "name": "dal13.pod01"
},   

I selected the "backendRouterId" for "Dallas 13", you can choose any datacenter that you want.

Reference:

https://softlayer.github.io/reference/services/SoftLayer_Network_Pod/getAllObjects/

To get the item prices ID for "Reserved Capacity" you can use this rest api:

Method: GET

https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/1059/getItemPrices?objectMask=mask[categories,pricingLocationGroup[locations]]

Keep in mind the item price id that you choose has to be in the same location that the "backendRouterId".

The item prices that do not have locations are standard, it means that are available for all locations.

Reference:

https://softlayer.github.io/reference/services/SoftLayer_Product_Package/getItemPrices/