如何使用softlayer REST API重新加载具有flex图像的系统

时间:2016-05-31 17:11:15

标签: java ibm-cloud-infrastructure

我正在尝试使用以下弹性图像重新加载裸机系统,但它不会持续存在。 REST调用有什么我做错了吗?

    String content = "{\"parameters\":[\"FORCE\",{\"sshKeyIds\":["+sshKeys+"]},{\"imageTemplateId\":803303}]}";

    Response response = RestAssured.given().contentType(ContentType.JSON).body(content).post("https://"+username+":"+apikey+"@api.softlayer.com/rest/v3/SoftLayer_Hardware_Server/"+softlayer_id+"/reloadOperatingSystem.json");

1 个答案:

答案 0 :(得分:0)

请使用SoftLayer_Hardware_Server::reloadOperatingSystem尝试以下 Rest 请求:

URL:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Hardware_Server/[Hardware_Id]/reloadOperatingSystem

Method: POST

Json Payload:

{
  "parameters": [
    "50ecea4c6cc06fa1eb346b5f627adfaa",
    {
      "imageTemplateId": 295000
    }
  ]
}

Where:

“50ecea4c6cc06fa1eb346b5f627adfaa” is the token (The token will remain active for 10 minutes)
“295000” the image template to use

•但是,如何获取上述配置的令牌?

执行:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Hardware_Server/[Hardware_Id]/reloadOperatingSystem

Method: GET