We are using SoftLayer Rest API for creating/modifying/deleting autoscale groups. Can we also use SoftLayer REST API, or any other kinds of APIs, to create/modify/delete bare metals?
1. Create Bare Metal
To create a baremetal using the simplified way, you need to use: SoftLayer_Hardware_Server::createObject method.
https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Hardware_Server/createObject
Method: Post
{
"parameters":[
{
"hostname":"rcvtest1",
"domain":"softlayer.com",
"processorCoreAmount":2,
"memoryCapacity":2,
"hourlyBillingFlag":true,
"datacenter":{
"name":"dal05"
},
"operatingSystemReferenceCode":"UBUNTU_LATEST"
}
]
}
There is another way to create a bare metal using SoftLayer_Product_Order::placeOrder method which provides more options at the moment to place an order, see the following forum to get more information about it:
SoftLayer API Hardware : How to order Bare Metal Server without OS using REST API
Another example: https://softlayer.github.io/rest/place_order/
2. Modify Bare Metal
To modify a bare metal, you need to use SoftLayer_Hardware_Server::editObject method, here an example:
https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Hardware_Server/$hardwareId/editObject
Method: Post
{
"parameters":[
{
"hostname": "rctestpar2"
}
]
}
You can edit some properties from your server, if you want to upgrade you should use: SoftLayer_Product_Order::placeOrder method, here an example in python:
https://softlayer.github.io/python/upgrade_examples/
3. Delete Bare Metal
To delete a bare metal, the following method will help with it: SoftLayer_Hardware_Server::deleteObject:
https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Hardware_Server/155392/deteleObject
Method: Get
Some references: