SIGN IN / UP
    opened image

    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):

    Parameter Example value Required parameter Value description
    func instances.snapshots.edit Yes Function to create snapshots
    auth 21fc199...c43f71 No Session token. This is one of the authorization options. More details on other options are described here
    out json Yes Response type to expect
    sok ok Yes Operation confirmation
    plid 5203773 Yes ID of the instance for which to create a snapshot
    name MySnapshot Yes Snapshot 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):

    Parameter Value
    func instances.snapshots.edit
    auth 21fc199...c43f71
    out json
    sok ok
    plid 5203773
    name MySnapshot

     

    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):

    Parameter Example value Required parameter Value description
    func instances.snapshots Yes Function to get all snapshots
    auth 21fc199...c43f71 No Session token. This is one of the authorization options. More details on other options are described here
    out json Yes Response type to expect
    elid 5203773 Yes ID 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 name Description

    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):

    Parameter Example value Required parameter Value description
    func image.delete Yes Function to delete a snapshot
    auth 21fc199...c43f71 No Session token. This is one of the authorization options. More details on other options are described here
    out json Yes Response type to expect
    plid 5203773 Yes ID of the instance whose snapshot is planned to be deleted
    elname

    5204214

    Yes ID of the snapshot to be deleted
    plid

    5204214

    Yes ID of the snapshot to be deleted
    sok ok Yes Operation 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: