SoftLayer_Account::getOperatingSystemReloadImages

2019-02-21 04:36发布

问题:

I want to use API to get the available OS list during OSReload. I found the method SoftLayer_Account::getOperatingSystemReloadImages is mentioned.But cannot find the usage about this method. Who can help me on this? Thanks.

回答1:

I was not able to find this method getOperatingSystemReloadImages. But I found a way to get OS reload options:

First, we need to know the package used to order the server. For example for Virtual Guests, the package used is 46. But if you want to confirm this, please execute the following Rest request:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/[vsi_id]/getBillingItem?objectMask=mask[package]

Method: GET

Then, to get ”Reload options”, execute:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Product_Package/46/getItemPrices?objectFilter={   "itemPrices": {     "categories": {       "categoryCode": {         "operation": "os"       }     }   } }&objectMask=mask[id,item[softwareDescription], categories[categoryCode]]

Method: GET

References:

SoftLayer_Virtual_Guest::getBillingItem

SoftLayer_Product_Package::getItemPrices

EDIT:

Now, in order to use ” SoftLayer_Virtual_Guest::reloadOperatingSystem”, we need add some parameters in Json body configuration: “token” and “config” (Ref: SoftLayer_Virtual_Guest::reloadOperatingSystem)

Below is a REST example:

URL:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/[virtual_Guest_ID]/reloadOperatingSystem

Method: POST

Json:

{
  "parameters": [
    "FORCE",
    {
      "itemPrices": [
        {
          "id": 45466
        }
      ]
    }
  ]
}

Where: 45466 is the new priceId of the OS



回答2:

See this example to reload OS https://gist.github.com/softlayer/407058