opened image

API - Interaction with Rescue

This article describes how to perform a Rescue operation using the API.

 

Using Rescue

To start the Rescue process for an instance, make a request in the following format:

 

URL: 

https://api.zomro.com/

Method: POST

Request Body (Form-data):

ParameterExample ValueRequired ParameterValue Description
funcinstances.fleio.rescueYesFunction to use Boot from ISO
auth21fc199...c43f71NoSession token. This is one of the authorization options. More details on other options can be found here
outjsonYesExpected response type
sokokYesOperation confirmation
elid5203773YesInstance ID
select_bootf8f2573f-56c4-44c5-8469-84eee4aa64e7YesUUID of the image to be used
passwordMyPassword1NoServer access password in Rescue mode. It is recommended to set it to have access to the server
zonepubYesZone type where the image is located. Available parameters: «own», «pub».

 

Example of switching an Instance to Boot From ISO mode

For example, we use the service:

and load the following image:
 

 

URL: 

https://api.zomro.com/

 

Method: POST

Request Body (Form-data):

ParameterValue
funcinstances.fleio.rescue
auth21fc199...c43f71
outjson
sokok
elid5203773
select_boot_from_isof8f2573f-56c4-44c5-8469-84eee4aa64e7
zonepub
passwordMyPassword1

 

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

curl --location 'https://api.zomro.com/' \
--form 'func="instances.fleio.rescue"' \
--form 'auth="43137b5f35a6ba4ee01f4a4e"' \
--form 'out="json"' \
--form 'elid="5203773"' \
--form 'sok="ok"' \
--form 'select_boot="f8f2573f-56c4-44c5-8469-84eee4aa64e7"' \
--form 'password="MyPassword1"' \
--form 'zone="pub"'

 

After executing the request, we see that the instance has switched to «Rescue» mode. This is confirmed by the result in the photo:

 

 

Also, if the sok parameter is not passed, the request will be executed in preview mode. By executing this request, you can get the available images for switching to rescue from the selected image. For example, let's execute the following request without the «sok» parameter:

 

curl --location 'https://api.zomro.com/' \
--form 'func="instances.fleio.rescue"' \
--form 'auth="43137b5f35a6ba4ee01f4a4e"' \
--form 'out="json"' \
--form 'elid="5203773"' 


We get the following response:

 

{
    "doc": {
        ...
        "slist": [
            {
                "$name": "zone",
                "val": [
                    {
                        "$key": "pub",
                        "$": "pub"
                    },
                    {
                        "$key": "own",
                        "$": "own"
                    }
                ]
            },
            {
                "$name": "select_boot",
                "val": [
                    {
                        "$depend": "pub",
                        "$key": "f8f2573f-56c4-44c5-8469-84eee4aa64e7",
                        "$": "Ubuntu 22.04"
                    },
                    {
                        "$depend": "pub",
                        "$key": "0bf4deb2-855c-4863-8518-6006d804adbb",
                        "$": "Debian 10"
                    },
                    {
                        "$depend": "pub",
                        "$key": "18d0ee2e-4d57-4f40-9b56-03c1773b5831",
                        "$": "AlmaLinux 8"
                    },
                    {
                        "$depend": "pub",
                        "$key": "1d9dda4c-34b0-4304-a90a-8f3018722fa2",
                        "$": "Rocky-Linux-8"
                    },
                    {
                        "$depend": "pub",
                        "$key": "2af0af94-0e6e-4ef3-8837-d41fdbfa3564",
                        "$": "Windows Server 2016"
                    },
                    {
                        "$depend": "pub",
                        "$key": "3010ae60-0185-4021-98da-f50013147ebd",
                        "$": "Debian 11"
                    },
                    {
                        "$depend": "pub",
                        "$key": "479c96f1-ccc6-47a2-952c-c9e3bbdc8d07",
                        "$": "Ubuntu 20.04"
                    },
                    {
                        "$depend": "pub",
                        "$key": "5da4ad83-45f6-4c0e-9a7e-7a7c18b2be6c",
                        "$": "AlmaLinux 9"
                    },
                    {
                        "$depend": "pub",
                        "$key": "7d7911e3-7178-4f36-a308-d841db5fe654",
                        "$": "CentOS Stream 9"
                    },
                    {
                        "$depend": "pub",
                        "$key": "92fabac2-69cc-46ad-8439-c377e0c90632",
                        "$": "Ubuntu 23.04"
                    },
                    {
                        "$depend": "pub",
                        "$key": "93878ba5-6b9e-4924-a4be-34edb623f808",
                        "$": "Debian 12"
                    },
                    {
                        "$depend": "pub",
                        "$key": "a8b7bcb3-6698-4264-b413-f2b866a46a70",
                        "$": "Rocky-Linux-9"
                    },
                    {
                        "$depend": "pub",
                        "$key": "b10434c0-d839-428f-a919-cac733fd6552",
                        "$": "Windows Server 2019"
                    },
                    {
                        "$depend": "pub",
                        "$key": "bda2467e-e192-4e4e-becc-cda2e71b9767",
                        "$": "Windows Server 2022"
                    },
                    {
                        "$depend": "own",
                        "$name": "foo",
                        "$key": "a9e7c223-5f11-4546-a298-6af546bebde6",
                        "$": "Centos 9 x64"
                    },
                ]
            }
        ],
    
    }
}

 

Analyzing this response structure, the data of interest is found in the following nesting:

 

doc.slist.[]

 

As we can see, the available images are:

UUIDImage NameOS NameVisibility

f8f2573f-56c4-44c5-8469-84eee4aa64e7

-

Ubuntu 22.04

pub

0bf4deb2-855c-4863-8518-6006d804adbb

-

Debian 10

pub

18d0ee2e-4d57-4f40-9b56-03c1773b5831

-

AlmaLinux 8

pub

1d9dda4c-34b0-4304-a90a-8f3018722fa2

-

Rocky-Linux-8

pub

2af0af94-0e6e-4ef3-8837-d41fdbfa3564

-

Windows Server 2016

pub

3010ae60-0185-4021-98da-f50013147ebd

-

Debian 11

pub

479c96f1-ccc6-47a2-952c-c9e3bbdc8d07

-

Ubuntu 20.04

pub

5da4ad83-45f6-4c0e-9a7e-7a7c18b2be6c

-

AlmaLinux 9

pub

7d7911e3-7178-4f36-a308-d841db5fe654

-

CentOS Stream 9

pub

92fabac2-69cc-46ad-8439-c377e0c90632

-

Ubuntu 23.04

pub

93878ba5-6b9e-4924-a4be-34edb623f808

-

Debian 12

pub

a8b7bcb3-6698-4264-b413-f2b866a46a70

-

Rocky-Linux-9

pub

b10434c0-d839-428f-a919-cac733fd6552

-

Windows Server 2019

pub

bda2467e-e192-4e4e-becc-cda2e71b9767

-

Windows Server 2022

pub
a9e7c223-5f11-4546-a298-6af546bebde6fooCentos 9 x64own

 

An image with the «pub» access modifier is available to all users. However, with «own» - it is available only to the image owner.
  

Also, to exit the «Rescue» mode, execute the following API request in the following format:

 

URL: 

https://api.zomro.com/

Method: POST

Request Body (Form-data):

ParameterExample ValueRequired ParameterValue Description
funcinstances.fleio.unrescueYesFunction to exit «Rescue» mode
auth21fc199...c43f71NoSession token. This is one of the authorization options. More details on other options can be found here
outjsonYesExpected response type
elid5203773YesInstance ID

 

How to Disable «Rescue» Mode

 

For example, let's disable the «Rescue» mode for the Instance with ID 5203773.

Let's try to execute the following request in the console:

curl --location 'https://api.zomro.com/' \
--form 'func="instances.fleio.unrescue"' \
--form 'auth="0b31d69ab7b7b4839dfd6506"' \
--form 'out="json"' \
--form 'elid="5203773"'

After executing the request, we see that the service is active:

​​​​​​​

 

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