opened image

API - Interaction with Snapshots

This document describes the process of creating, viewing, and deleting snapshots for an instance using the Zomro service API. The provided request examples will help you quickly understand the basic operations needed to manage snapshots through the API.

 

Creating snapshots

To create snapshots, execute the following request:

 

URL: 

https://api.zomro.com/

Method: POST

Request body (Form-data):

ParameterExample valueRequired parameterValue description
funcinstances.snapshots.editYesFunction to create snapshots
auth21fc199...c43f71NoSession token. This is one of the authorization options. More details on other options are described here
outjsonYesResponse type to expect
sokokYesOperation confirmation
plid5203773YesID of the instance for which to create a snapshot
nameMySnapshotYesSnapshot name

 

Example of creating snapshots for a service

For example, we use the service:

 

 

URL: 

https://api.zomro.com/

 

Method: POST

Request body (Form-data):

ParameterValue
funcinstances.snapshots.edit
auth21fc199...c43f71
outjson
sokok
plid5203773
nameMySnapshot

 

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

 

curl --location 'https://api.zomro.com/' \
--form 'func="instances.snapshots.edit"' \
--form 'auth="5acd1215da7a09eaae215987"' \
--form 'out="json"' \
--form 'sok="ok"' \
--form 'plid="5203773"' \
--form 'name="MySnapshot"'

 

After executing the request, we see that the snapshot is in the process of being created. This information can be obtained from the Status field, which has the value Saving:

 

 

After the backup creation is complete, the snapshot status will change from Saving to Active:

 

 

As we can see, the snapshot status is Active.

 

How to get a list of snapshots

 

Also, using the API, it is possible to get a list of snapshots. To do this, execute the following request format:

 URL: 

https://api.zomro.com/

Method: POST

Request body (Form-data):

ParameterExample valueRequired parameterValue description
funcinstances.snapshotsYesFunction to get all snapshots
auth21fc199...c43f71NoSession token. This is one of the authorization options. More details on other options are described here
outjsonYesResponse type to expect
elid5203773YesID of the instance whose snapshots are planned to be obtained

 

For example, let's try to get snapshots for service 5203773. In the previous step, we created 1 snapshot. Let's try to get it.

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

curl --location 'https://api.zomro.com/' \
--form 'func="instances.snapshots"' \
--form 'auth="9046d78a8fda29dda83d42dd"' \
--form 'out="json"' \
--form 'elid="5203773"'

We get the following result:

{
    "doc": {
        ...
        "elem": [
            {
                "architecture": {
                    "$": "x86_64"
                },
                "createdate": {
                    "$": "2024-07-23"
                },
                "disk_format": {
                    "$": "qcow2"
                },
                "fleio_id": {
                    "$": "afd72725-81aa-43ad-984c-a3f3a05b4b84"
                },
                "fleio_status": {
                    "$": "Active"
                },
                "hypervisor_type": {
                    "$": "any_hypervisor"
                },
                "id": {
                    "$": "5204214"
                },
                "image_size": {         
                    "$": "3"
                },
                "item_real_status": {
                    "$": "2"
                },
                "min_disk": {
                    "$": "20"
                },
                "min_ram": {
                    "$": "0"
                },
                "name": {
                    "$": "MySnapshot"
                },
                "os_distro": {
                    "$": "Ubuntu"
                },
                "os_version": {
                    "$": "22.04 x64"
                },
                "protected": {
                    "$": "off"
                },
                "region": {
                    "$": "Netherlands-2"
                },
                "visibility": {
                    "$": "private"
                }
            }
        ],
    }
}

 

We are interested in the data obtained in the following nesting:

doc.elem.[]

 

From this response, we get the following data:

Field nameDescription

architecture

Virtual machine architecture

createdate

Snapshot creation time

disk_format

Snapshot file type

fleio_id

Unique UUID in the fleio system

fleio_status

Snapshot status. The value Active means the snapshot is created

hypervisor_type

Hypervisor type for the virtual machine

id

Snapshot ID within the bill manager

image_size

Actual snapshot size. Determined after the snapshot creation is complete

item_real_status

Service status within the bill manager

min_disk

Minimum disk size on the server needed to restore this snapshot

min_ram

Minimum RAM size on the server needed to restore this snapshot

name

Snapshot name

os_distro

Operating system name

os_version

Operating system version

protected

Indicates whether the snapshot can be deleted. If the value is "off", the snapshot can be deleted. If "on", the snapshot cannot be deleted.

region

Data center name where the snapshot is located

visibility

Snapshot access status. The only available value is "Private"

 

To delete a snapshot, execute the following request:

 URL: 

https://api.zomro.com/

Method: POST

Request body (Form-data):

ParameterExample valueRequired parameterValue description
funcimage.deleteYesFunction to delete a snapshot
auth21fc199...c43f71NoSession token. This is one of the authorization options. More details on other options are described here
outjsonYesResponse type to expect
plid5203773YesID of the instance whose snapshot is planned to be deleted
elname

5204214

YesID of the snapshot to be deleted
plid

5204214

YesID of the snapshot to be deleted
sokokYesOperation confirmation

 

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

curl --location 'https://api.zomro.com/' \
--form 'func="image.delete"' \
--form 'auth="9046d78a8fda29dda83d42dd"' \
--form 'out="json"' \
--form 'sok="ok"' \
--form 'plid="5203773"' \
--form 'elname="5204214"' \
--form 'elid="5204214"'

After executing the request, you can check the result using the "instances.fleio_bckps" function, or by viewing it through the web interface:

 

 

As you can see, the snapshot was successfully deleted.

 

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