opened image

API - Operation Rebuild

To initiate the Rebuild operation via the API, you need to use a specific function and pass the necessary request parameters. Below are the request details, including the URL, method, and required parameters that need to be specified for the successful execution of the operation.

To initiate the Rebuild operation, use the following function.

 

URL: 

https://api.zomro.com/

Method: POST

Request Body (Form-data):

 

Parameter Example Value Required Parameter Value Description
func instances.fleio.rebuild Yes Function to initiate the server rebuild
auth 21fc199...c43f71 No Session token. This is one of the authorization options. More details on other options are described here
out json Yes Expected response type
sok ok Yes Operation confirmation
elid 5113119 Yes ID of the service to perform the operation on
zone image Yes Section from which to use images for OS reinstallation
select_rebuild 18d0ee2e-4d57-4f40-9b56-03c1773b5831 Yes UID of the operating system to reinstall the instance. The UID of the operating system can be obtained from the function v2.instances.order.pricelist. More details on how to use it are described here
enablessh off Yes Whether to use an SSH key or not. Can take values off or on.
password Mypassword1 No Server access password. For Linux, the password for the root user. For Windows, the password for the Administrator user. Do not pass if the parameter enablessh=on.
Also, the password must contain at least 1 uppercase English letter, 1 numeric character, and a minimum of 8 characters.  
ssh_keys 490 No

ID of the SSH key to add to the server after OS installation. Do not pass if the parameter use_ssh_key=off.
The ID of the SSH key can be obtained from the function v2.instances.order.pricelist. More details on how to use it are described here

 

Example of executing rebuild

For example, we use a service with Ubuntu 20.04 and perform a rebuild to AlmaLinux 8, and set a password for the root user - Mypassword1.

 

URL: 

https://api.zomro.com/

 

Method: POST

Request Body (Form-data):

 

Parameter Value
func instances.fleio.rebuild
auth 21fc199...c43f71
out json
sok ok
elid 5113119
zone image
select_rebuild 18d0ee2e-4d57-4f40-9b56-03c1773b5831
enablessh off
password Mypassword1

 

Here is an example request that can be executed from the console:

curl --location 'https://api.zomro.com/' \
--form 'func="instances.fleio.rebuild"' \
--form 'auth="f1662dcabc6b96c85be3af64"' \
--form 'elid="5113119"' \
--form 'zone="image"' \
--form 'select_rebuild="18d0ee2e-4d57-4f40-9b56-03c1773b5831"' \
--form 'enablessh="off"' \
--form 'password="Mypassword12"' \
--form 'sok="ok"' \
--form 'out="json"'

 

This operation takes some time as the operating system is reinstalled during the operation. Depending on the OS, the waiting time may vary.

After executing the request, we can verify that the operating system has been reinstalled in the personal account or via the API


 

The result of the operation can also be seen in the operation history in the graphical interface.

 

 

As we can see, the operation was successful.

 

We also recommend studying articles that may be useful for interacting with Cloud VPS products using the API: