Save Image

To Save Image of existing Node send a POST request to the endpoint

https://api.e2enetworks.com/myaccount/api/v1/nodes/<$NODE_ID>/actions/?apikey={{api_key}}&project_id={{project_id}}

Set the “type” attribute to save_images .

List all Images

#

Name

Type

Description

Required

1

type

String

Name of node images

TRUE

2

name

string

The name of the save image.

TRUE

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
              "name": "C2-12GB-CentOS-Stream-412-11",
              "type": "save_images"
        })
headers = {
            'Authorization': 'api_token',
              'Content-Type': 'application/json',
            }
conn.request("POST", "/myaccount/api/v1/nodes/{{node_id}}/actions/?apikey={{api_key}}&project_id={{project_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
   "message": "Success",
   "code": 200,
   "data": {
       "id": 773,
       "created_at": "2019-10-31T06:13:47.613831Z",
       "status": "done",
       "action_type": "save_images",
       "resource_id": "34339"
   },
   "errors": {}
}

Saved Image Listing

To get the list of Saved Image in your MyAccount, send a GET request to the endpoint https://api.e2enetworks.com/myaccount/api/v1/images/?apikey={{api_key}}.

The response returns an array of JSON objects; each JSON object represents the information of each saved image.

The JSON objects contain the following attributes:

#

Name

Type

Description

1

image_state

String

State of the image

2

name

String

The name of the saved image.

3

running_vms

integer

Running VM count with this image

4

creation_time

String

The time when node created represented in ISO8601 which includes both the date and time.

5

image_id

integer

The ID of the saved image.

6

vm_info

String

Running VM’s Information

7

image_size

String

Size of the image in GB

8

os_distribution

String

The name of the saved image.

9

template_id

integer

The template id of the image

10

distro

String

The Distro details of the image

import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
            'Authorization': 'api_token'
    }
conn.request("GET", "/myaccount/api/v1/images/saved-images/?apikey={{api_key}}&location=Delhi&project_id={{project_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "message": "Success",
    "code": 200,
    "data": [
        {
            "image_state": "Ready",
            "name": "test-disk-0",
            "running_vms": "0",
            "creation_time": "31-10-2019 11:59:58",
            "image_id": "2292",
            "vm_info": null,
            "image_size": "57 GB",
            "os_distribution": "test",
            "template_id": "3638",
            "distro": "CentOS-7.5"
        }
    ],
    "errors": {}
}

Rename Saved Image

Send a POST request to the endpoint to rename a saved image from your MyAccount. https://api.e2enetworks.com/myaccount/api/v1/images/<$IMAGE_ID>/?apikey={{api_key}}&project_id={{project_id}}.

#

Name

Type

Description

Required

1

action_type

String

Must be rename

TRUE

2

name

String

The new name of the saved image.

TRUE

  import http.client
  import json

  conn = http.client.HTTPSConnection("api.e2enetworks.com")
  payload = json.dumps({
              "action_type": "rename",
              "name": "c2-12gb-centos-image-set1"
            })
  headers = {
                  'Authorization': 'api_token',
                  'Content-Type': 'application/json',
              }
  conn.request("POST", "/myaccount/api/v1/images/{{image_id}}/?apikey={{api_key}}&location=Delhi&project_id={{project_id}}", payload, headers)
  res = conn.getresponse()
  data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
   "message": "Success",
   "code": 200,
   "data": {
       "status": true,
       "message": "Image name changed successfully"
   },
   "errors": {}
}

Delete Saved Image

Send a POST request to the endpoint to delete a saved image from your MyAccount. https://api.e2enetworks.com/myaccount/api/v1/images/<$IMAGE_ID>/?apikey={{api_key}}&project_id={{project_id}}.

#

Name

Type

Description

Required

1

action_type

String

Must be delete_image

TRUE

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
                    "action_type": "delete_image"
            })
headers = {
          'Authorization': 'api_token',
          'Content-Type': 'application/json',
        }
conn.request("POST", "/myaccount/api/v1/images/{{image_id}}/?apikey={{api_key}}&location=Delhi&project_id={{project_id}}", payload, headers)
  res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
   "message": "Success",
   "code": 200,
   "data": {
       "status": true,
       "message": "Image deleted successfully"
   },
   "errors": {}
}