Search code examples
sshibm-cloud-infrastructure

Generate a SoftLayer_Security_Ssh_Key object API


I want to generate a new SSH Key for my SoftLayer account.

I found an example of how to upload a generated key. https://developer.ibm.com/marketplace/docs/technical-scenarios/obtain-virtual-server-ibm-cloud/

But what I want is to generate a key, so I tried to call the following REST but I'm not able to make it work

Http Method: [POST]

API: rest/v3.1/SoftLayer_Security_Ssh_Key.json

Body:

{   "parameters": [
     {
       "label": "new-ssh-key"
     }
]}

Respose:

{
"error": "Key is required."
"code": "SoftLayer_Exception_Public"
}

Also, I checked the methods of SoftLayer_Security_Ssh_Key but it doesn't have any method to generate a key.

Do you know if it is even possible to generate a SSH Key by calling the SoftLayer API ?

Thank you


Solution

  • It's not possible to generate a Ssh Key through API. The API just creates a record, that will attach a ssh key to your account (So, in this case you need the Ssh Key already generated)

    The API will do the same like this: https://control.softlayer.com/devices/sshkeys