softlayer api: change root password and ssh-key operation
<p>I am a developer, my current work is writing a script to manage the softlayer VMs. The problems are about change Root Password and binding(remove binding) the SshKey. My questions are:</p>

<ol>
<li><p>I have a running softlayer vm, wihch softlayer api can help me to change the vmâs root password. </p></li>
<li><p>I have a running softlayer vm which has not bind sshkey before. Does any softlayer api can help me to bind ssh-key with this vm?</p></li>
<li><p>Contray to point 2, how can I unbind the sshkey by using softlayer api?</p></li>
</ol>

<p>Regarding to your <strong>first question</strong>, change root password from vm, follow these steps:</p>

<p>Retrieves the password's identifier from the vm</p>

<pre><code>https://$user:$apiKey@api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/$vsiId/getSoftwareComponents?objectMask=mask[passwords]

Method: Get
</code></pre>

<p>Replace <strong>$user</strong>, <strong>$apiKey</strong> and <strong>$vsiId</strong> with you own information</p>

<p>You will get a result like this:</p>

<pre><code>hardwareId": null
"id": 345676755
"manufacturerLicenseInstance": "C412F72A-1BB1-4C07-9467-E55729234F8E"
"passwords": [1]
0:  {
"createDate": "2016-06-09T11:10:28-03:00"
"id": 122333
"modifyDate": "2016-09-06T11:19:18-03:00"
"password": "Cochabamba"
"port": null
"softwareId": 11209641
"username": "Ruber"
"software": null
}
}
</code></pre>

<p>Then you can update using the following call:</p>

<pre><code>https://$user:$apiKey@api.softlayer.com/rest/v3.1/SoftLayer_Software_Component_Password/$passwordId/editObject

Method: Post

{  
   "parameters":[  
      {  
         "username":"usernameTest",
         "password":"Password*-"
      }
   ]
}
</code></pre>

<p>Replace: <strong>$user</strong>, <strong>$apiKey</strong> and <strong>$passwordId</strong> with you own information, in this case the <strong>$passwordId</strong> is: <strong>122333</strong></p>

<p>Regarding to your <strong>second</strong> and <strong>third</strong> question, unfortunately it's not possible to do this through SoftLayer API, it is necessary to do an OS Reload</p>

python api softlayer