问题
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