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 `````````````````` .. csv-table:: :file: tables/saveimage.csv :widths: 20, 20, 60, 10, 10 :header-rows: 1 .. tabs:: .. code-tab:: Python http Client 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")) .. code-tab:: Python Request import requests import json url = "https://api.e2enetworks.com/myaccount/api/v1/nodes/{{node_id}}/actions/?apikey={{api_key}}&project_id={{project_id}}" payload = json.dumps({ "name": "C2-12GB-CentOS-Stream-412-11", "type": "save_images" }) headers = { 'Authorization': 'api_token', 'Content-Type': 'application/json', } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: python Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: python Response Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: Python Response Body { "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: .. csv-table:: :file: tables/saveimagelisting.csv :widths: 10, 10, 30, 60 :header-rows: 1 .. tabs:: .. code-tab:: Python Http Client 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")) .. code-tab:: Python Request import requests url = "https://api.e2enetworks.com/myaccount/api/v1/images/saved-images/?apikey={{api_key}}&location=Delhi&project_id={{project_id}}" payload={} headers = { 'Authorization': 'api_token' } response = requests.request("GET", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: python Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: python Response Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: Python Response Body { "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}}.** .. csv-table:: :file: tables/renamesaveimage.csv :widths: 20, 20, 60, 10, 10 :header-rows: 1 .. tabs:: .. code-tab:: Python Http Client 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")) .. code-tab:: Python Request import requests import json url = "https://api.e2enetworks.com/myaccount/api/v1/images/{{image_id}}/?apikey={{api_key}}&location=Delhi&project_id={{project_id}}" payload = json.dumps({ "action_type": "rename", "name": "c2-12gb-centos-image-set1" }) headers = { 'Authorization': 'api_token', 'Content-Type': 'application/json', } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: python Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: python Response Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: Python Response { "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}}.** .. csv-table:: :file: tables/deletesaveimage.csv :widths: 20, 20, 60, 10, 10 :header-rows: 1 .. tabs:: .. code-tab:: Python Http Client 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")) .. code-tab:: Python Request import requests import json url = "https://api.e2enetworks.com/myaccount/api/v1/images/{{image_id}}/?apikey={{api-key}}&location=Delhi&project_id={{project_id}}" payload = json.dumps({ "action_type": "delete_image" }) headers = { 'Authorization': 'api_token', 'Content-Type': 'application/json', } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: python Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: python Response Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: Python Response Body { "message": "Success", "code": 200, "data": { "status": true, "message": "Image deleted successfully" }, "errors": {} }