How to reload system with flex image using softlayer REST API

醉酒当歌 提交于 2019-12-12 00:05:30

问题


I'm trying to reload a bare metal system with the following flex image but it isn't persisting. Is there something I'm doing wrong is the REST call?

    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:


Please try the following Rest request using SoftLayer_Hardware_Server::reloadOperatingSystem:

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

• But, How to get the token for our above configuration?

Execute:

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

Method: GET


来源:https://stackoverflow.com/questions/37551817/how-to-reload-system-with-flex-image-using-softlayer-rest-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!