Node API
A Node is a virtual machine. To perform actions and to get information, you shall send requests to the node endpoint.
List of OS Images
To get the list of os, send a GET request to the node Endpoint
https://api.e2enetworks.com/myaccount/api/v1/images/category-list/?apikey={{api_key}}&project_id={{project_id}}&location={{location}}
import requests
import json
url = "https://api.e2enetworks.com/myaccount/api/v1/images/category-list/?apikey={{api_key}}&project_id={{project_id}}&location={{location}}"
payload = {}
headers = {
'Authorization': 'Bearer {{Token}}',
'Content-Type': 'application/json',
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
curl --location 'https://api.e2enetworks.com/myaccount/api/v1/images/os-category/?active=true&apikey={{api_key}}&project_id={{project_id}}&location={{location}}' \
--header 'Authorization: Bearer {{Token}}' \
--header 'Content-Type: application/json'
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
content-type: application/json; charset=utf-8
status: 202 Accepted
ratelimit-limit: 1200
ratelimit-remaining: 965
ratelimit-reset: 1415984218
List Of Plans
To get the list of all Plans, send a GET request to the node endpoint
https://api.e2enetworks.com/myaccount/api/v1/images/?display_category=Linux%20Virtual%20Node&category=CentOS&osversion=7&gpu_type=&ng_container=null&os=CentOS&apikey={{api_key}}&project_id={{project_id}}&location={{location}}
import requests
import json
url = "https://api.e2enetworks.com/myaccount/api/v1/images/?display_category=Linux%20Virtual%20Node&category=CentOS&osversion=7&gpu_type=&ng_container=null&os=CentOS&apikey={{api_key}}&project_id={{project_id}}&location={{location}}"
payload = {}
headers = {
'Accept': 'application/json, text/plain, */*',
'Authorization': 'Bearer {{Token}}',
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
curl --location 'https://api.e2enetworks.com/myaccount/api/v1/images/?display_category=Linux%20Virtual%20Node&category=CentOS&osversion=Stream&gpu_type=&ng_container=&os=CentOS&apikey={{api_key}}&project_id={{project_id}}&location={{location}}' \
--header 'Accept: application/json, text/plain, */*' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{api_key}}'
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
content-type: application/json; charset=utf-8
status: 202 Accepted
ratelimit-limit: 1200
ratelimit-remaining: 965
ratelimit-reset: 1415984218
Create a New Node
To create a node, send a POST request to the node endpoint
https://api.e2enetworks.com/myaccount/api/v1/nodes/?apikey={{api_key}}&project_id={{project_id}}
Attributes and respective values required to send this POST request are:
Name |
Type |
Description |
Required |
---|---|---|---|
name |
String |
A string used as name for the node. |
TRUE |
region |
String |
Identifier of the region you wish to create node in. (Currently, only ncr region is available.) |
TRUE |
plan |
String |
Unique identifier that specifies the plan name of the node. |
TRUE |
image |
integer (if using an image ID), or String (if using a public image slug) |
Unique image ID of public or private image, or identifier of the public image; which would be the base image for the node. |
TRUE |
ssh_keys |
Array |
An array of SSH Key fingerprints or IDs that you wish to include in the root account after the node’s creation. |
FALSE |
backups |
Boolean |
A boolean indicating to enable or to disable automated backups. Enabling automated backups is possible only when creating the node. |
FALSE |
tags |
Array |
An array of tag names in string format to be associated with node after its creation. Tag names can be new or existing names. |
FALSE |
is_saved_image |
Boolean |
A boolean indicating image is saved or base image. |
|
saved_image_template_id |
Integer |
Template Id of saved image. |
|
cn_id |
Integer |
committed_sku_id of plan |
FALSE |
number_of_instances |
Integer |
Number of nodes you want to launch together and default value is taken as 1. |
FALSE |
import requests
import json
# Generate API key and auth_token from myaccount
YOUR_API_KEY = ''&project_id={{project_id}}
YOUR_AUTH_TOKEN = '{{Auth_token}}'
# Assign your ssh key
ssh_key = 'rsa AAA= user@host'
url = f'https://api.e2enetworks.com/myaccount/api/v1/nodes/'
headers = {'x-api-key': YOUR_API_KEY, 'Content-Type': 'application/json', 'Authorization' : f'Bearer {YOUR_AUTH_TOKEN}' }
def create_node():
payload = json.dumps({
"label": "Default",
"name": "C2-12GB",
"region": "ncr",
"plan":"{{Plan_name}}",
"image": "{{image_name}}",
"ssh_keys": [],
"backups": False,
"enable_bitninja": False,
"disable_password": False,
"is_saved_image": False,
"saved_image_template_id": None,
"reserve_ip": "",
"is_ipv6_availed": False,
"vpc_id": "",
"number_of_instances" : 2,
"default_public_ip": False,
"ngc_container_id": None,
"security_group_id": 3482,
"start_scripts": []
})
response = requests.request("POST", url, data=payload, headers=headers)
print(response.status_code)
resp = response.content
print("response=",resp)
create_node()
curl 'https://api.e2enetworks.com/myaccount/api/v1/nodes/?apikey={{api_key}}&project_id={{project_id}}&location={{location}}' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: en-gb' \
-H 'Authorization: Bearer {{token}}' \
-H 'Content-Type: application/json' \
-H 'Origin: https://myaccount.e2enetworks.com' \
-H 'Pragma: no-cache' \
-H 'Referer: https://myaccount.e2enetworks.com/' \
-H 'x-api-key: {{api_key}}' \
--data-raw '{"label":"Default","name":"C3-8GB-102","region":"ncr","plan":"C3-4vCPU-8RAM-100DISK-C3.250GB-CentOS-Stream8-Delhi-NCR-2","image":"CentOS-Stream-Distro","ssh_keys":[""],"start_scripts":[],"backups":false,"enable_bitninja":false,"disable_password":true,"number_of_instances":2,"is_saved_image":false,"saved_image_template_id":null,"reserve_ip":"","reserve_ip_pool":"","is_ipv6_availed":false,"vpc_id":"","default_public_ip":false,"ngc_container_id":null,"security_group_id":50830,"is_encryption_required":false}'
--compressed
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
content-type: application/json; charset=utf-8
status: 202 Accepted
ratelimit-limit: 1200
ratelimit-remaining: 965
ratelimit-reset: 1415984218
{
"label": "Default",
"name": "C2-12GB",
"region": "ncr",
"plan":"{{Plan_name}}",
"image": "{{image_name}}",
"ssh_keys": [],
"backups": False,
"enable_bitninja": False,
"disable_password": False,
"is_saved_image": False,
"saved_image_template_id": None,
"reserve_ip": "",
"is_ipv6_availed": False,
"vpc_id": "",
"number_of_instances":2,
"default_public_ip": False,
"ngc_container_id": None,
"security_group_id": 3482,
"start_scripts": []
}
{
"code": 200,
"data": {
"total_number_of_node_requested": 2,
"total_number_of_node_created": 2,
"node_create_response": [
{
"id": 193993,
"name": "C3-8GB-545",
"vm_id": 208560,
"created_at": "************",
"public_ip_address": "***.***.***.***",
"private_ip_address": "***.***.***.***",
"backup": false,
"disk": "100 GB",
"status": "Creating",
"vcpus": "4",
"memory": "8 GB",
"plan": "C3.8GB",
"region": null,
"is_locked": false,
"zabbix_host_id": null,
"zabbix_host_id_v2": null,
"gpu": "",
"price": "Rs. ***/Hour or Rs. **** Monthly",
"additional_ip": [],
"label": "default",
"ssh_keys": [
{
"label": "TESTING",
"ssh_key": "{{ssh_keys}}"
}
],
"is_active": true,
"scaler_id": null,
"os_info": {
"name": "Ubuntu",
"version": "18.04",
"category": "Linux Virtual Node",
"full_name": "Ubuntu ****"
},
"is_monitored": false,
"backup_status": {
"status": "backup_not_activated",
"detail": "Not Activated",
"node_id": 193993,
"is_encryption_enabled": false
},
"location": "Mumbai",
"monitor_status": {
"status": "not_activated",
"reason": ""
},
"enable_bitninja_details": {
"show_bitninja": true,
"bitninja_cost": 760.0
},
"is_bitninja_license_active": false,
"any_license_attached": {
"is_license_attached": false,
"license_deletion_message": "",
"mssql_license_attached": false
},
"is_committed": false,
"audit_log_message": null,
"monitoring_tab_enabled": true,
"cdp_tab_enabled": true,
"alert_tab_enabled": true,
"bitninja_discount_percentage": 0.0,
"is_image_deleted": false,
"vpc_enabled": false,
"is_snapshot_allowed": true,
"is_fortigate_vm": false,
"rescue_mode_status": "Disabled",
"is_upgradable": true,
"abuse_flag": false,
"currency": "INR",
"vm_type": "vm",
"is_accidental_protection": false,
"project_name": "newh",
"resource_type": null,
"label_id": null
},
{
"id": 193994,
"name": "C3-8GB-545",
"vm_id": 208561,
"created_at": "************",
"public_ip_address": "***.***.***.***",
"private_ip_address": "***.***.***.***",
"backup": false,
"disk": "100 GB",
"status": "Creating",
"vcpus": "4",
"memory": "8 GB",
"plan": "C3.8GB",
"region": null,
"is_locked": false,
"zabbix_host_id": null,
"zabbix_host_id_v2": null,
"gpu": "",
"price": "Rs. ***/Hour or Rs. *** Monthly",
"additional_ip": [],
"label": "default",
"ssh_keys": [
{
"label": "TESTING",
"ssh_key": "{{ssh_keys}}"
}
],
"is_active": true,
"scaler_id": null,
"os_info": {
"name": "Ubuntu",
"version": "18.04",
"category": "Linux Virtual Node",
"full_name": "Ubuntu ***"
},
"is_monitored": false,
"backup_status": {
"status": "backup_not_activated",
"detail": "Not Activated",
"node_id": 193994,
"is_encryption_enabled": false
},
"location": "Mumbai",
"monitor_status": {
"status": "not_activated",
"reason": ""
},
"enable_bitninja_details": {
"show_bitninja": true,
"bitninja_cost": 760.0
},
"is_bitninja_license_active": false,
"any_license_attached": {
"is_license_attached": false,
"license_deletion_message": "",
"mssql_license_attached": false
},
"is_committed": false,
"audit_log_message": null,
"monitoring_tab_enabled": true,
"cdp_tab_enabled": true,
"alert_tab_enabled": true,
"bitninja_discount_percentage": 0.0,
"is_image_deleted": false,
"vpc_enabled": false,
"is_snapshot_allowed": true,
"is_fortigate_vm": false,
"rescue_mode_status": "Disabled",
"is_upgradable": true,
"abuse_flag": false,
"currency": "INR",
"vm_type": "vm",
"is_accidental_protection": false,
"project_name": "newh",
"resource_type": null,
"label_id": null
}
]
},
"errors": {},
"message": "Success"
}
Get Node By ID
To get information regarding any node, send a GET request to the endpoint
https://api.e2enetworks.com/myaccount/api/v1/nodes/<$NODE_ID>/?apikey={{api_key}}&project_id={{project_id}}
The request returns a JSON object that contains the following node attributes:
Name |
Type |
Description |
---|---|---|
id |
integer |
A unique integer identifier created and assigned to the node after its creation. |
name |
string |
The name assigned to the node. |
vcpus |
integer |
The number of virtual CPUs of the node. |
disk |
integer |
The disk space of the node in gigabytes. |
locked |
boolean |
A boolean value denoting whether the node is locked or not. When locked, the feature prevents any user actions on the node. (Currently Unavailable) |
created_at |
string |
The time when node created represented in ISO8601 which includes both the date and time. |
status |
string |
A string that denotes the state of the node: ‘created’, ‘running’, ‘power-off’, or ‘terminate’. |
backups |
boolean |
A boolean value that indicates whether backups are enabled. |
public_ip_address/ private_ip_address |
object |
Information regarding the network configuration of the node. |
tags |
array |
Tags associated with the node, represented as an array. (currently not available) |
import requests
url = "https://api.e2enetworks.com/myaccount/api/v1/nodes/{{node_id}}/?apikey={{api_key}}&project_id={{project_id}}"
payload = {}
headers = {
'Authorization': 'Bearer {{your_auth_token}}',
'Cookie': 'csrftoken={{your_csrf_token}}; customer_role_auth={{your_customer_role_auth}}; sessionid={{your_session_id}}'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
curl --location 'https://api.e2enetworks.com/myaccount/api/v1/nodes/{{node_id}}/?apikey={{api_key}}&project_id={{project_id}}' \
--header 'Authorization: Bearer {{your_auth_token}}' \
--header 'Cookie: csrftoken={{your_csrf_token}}; customer_role_auth={{your_customer_role_auth}}; sessionid={{your_session_id}}'
// pending
// pending
Get Node List
To get the list of nodes in your MyAccount, send a GET request to the endpoint
https://api.e2enetworks.com/myaccount/api/v1/nodes/?apikey={{api_key}}&page_no=1&per_page=2&project_id={{project_id}}
The request returns an array of JSON objects; each JSON object represents the information of each node.
The JSON objects contain the following node attributes:
Name |
Type |
Description |
---|---|---|
id |
integer |
A unique integer identifier created and assigned to the node after its creation. |
name |
string |
The name assigned to the node. |
memory |
integer |
Memory (typically RAM) of the node represented in megabytes. |
vcpus |
integer |
The number of virtual CPUs of the node. |
disk |
integer |
The disk space of the node in gigabytes. |
locked |
boolean |
A boolean value denoting whether the node is locked or not. When locked, the feature prevents any user actions on the node. (Currently Unavailable) |
created_at |
string |
The time when node created represented in ISO8601 which includes both the date and time. |
status |
string |
A string that denotes the state of the node: ‘created’, ‘running’, ‘power-off’, or ‘terminate’. |
backup_ids |
array |
A boolean value that indicates whether backups are enabled. |
region |
string |
Identifier of the region you wish to create node in. (Currently, only ncr region is available.) |
image |
string |
Unique image ID of public or private image, or identifier of the public image; which would be the base image for the node. |
public_ip_address/ private_ip_address |
string |
Information regarding the network configuration of the node. |
tags |
array |
Tags associated with the node, represented as an array.(currenlty not available) |
import http.client
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
'Authorization': 'API Token',
'Content-Type': 'application/json',
}
conn.request("GET", "/myaccount/api/v1/nodes/?apikey=API key&location=Delhi&project_id={{project_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
import json
# Generate API key and auth_token from myaccount
YOUR_API_KEY = ''&project_id={{project_id}}
YOUR_AUTH_TOKEN = ''
# Assign your ssh key
ssh_key = 'rsa AAA= user@host'
url = f'https://api.e2enetworks.com/myaccount/api/v1/nodes/'
headers = {'x-api-key': YOUR_API_KEY,'Content-Type': 'application/json', 'Authorization' : f'Bearer {YOUR_AUTH_TOKEN}' }
# Stores the id of the VM created
id = ''
# Shows the status of the node
def check_node():
response = requests.get(url+f'/{id}/'+f'?apikey={YOUR_API_KEY}', headers = headers)
print(response)
check_node()
curl 'https://api.e2enetworks.com/myaccount/api/v1/nodes/{{node_id}}/?apikey={{api_key}}&project_id={{project_id}}&location=Delhi' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: en-gb' \
-H 'Authorization: Bearer {{token}}'\
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Origin: https://myaccount.e2enetworks.com' \
-H 'Pragma: no-cache' \
-H 'Referer: https://myaccount.e2enetworks.com/' \
-H 'x-api-key: {{api_key}}' \
--compressed
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
content-type: application/json; charset=utf-8
status: 202 Accepted
ratelimit-limit: 1200
ratelimit-remaining: 965
ratelimit-reset: 1415984218
{
"message": "Success",
"code": 200,
"data": [
{
"id": 169,
"name": "node-awa",
"created_at": "2019-04-23T09:19:28.842209Z",
"public_ip_address": "101.53.147.102",
"private_ip_address": "172.16.215.166",
"backup": false,
"disk": "60 GB",
"status": "Create",
"vcpus": "2",
"memory": "15.00 GB",
"plan": "B-2VCPU-8RAM-115DISK",
"region": "national capitail"
},
{
"id": 170,
"name": "hgfh",
"created_at": "2019-04-23T09:48:12.481261Z",
"public_ip_address": "101.53.147.241",
"private_ip_address": "172.16.215.84",
"backup": false,
"disk": "60 GB",
"status": "Create",
"vcpus": "2",
"memory": "15.00 GB",
"plan": "B-2VCPU-8RAM-115DISK",
"region": "national capitail"
}
],
"errors": {}
}
Delete node
Send a DELETE request to the endpoint to delete a node from your MyAccount.
https://api.e2enetworks.com/myaccount/api/v1/nodes/{{node_id}}/?apikey={{api_key}}&project_id={{project_id}}
import requests
import json
# Generate API key and auth_token from myaccount
YOUR_API_KEY = ''&project_id={{project_id}}
YOUR_AUTH_TOKEN = ''
# Assign your ssh key
ssh_key = 'rsa AAA= user@host'
url = f'https://api.e2enetworks.com/myaccount/api/v1/nodes/'
headers = {'x-api-key': YOUR_API_KEY,'Content-Type': 'application/json', 'Authorization' : f'Bearer {YOUR_AUTH_TOKEN}' }
# Stores the response of the created node
resp = ''
# Stores the id of the VM created
id = ''
# Deletes the node created in the example
def delete_node():
response = requests.delete(url+f'/{id}/'+f'?apikey={YOUR_API_KEY}', headers = headers)
print(response.json())
delete_node()
curl 'https://api.e2enetworks.com/myaccount/api/v1/nodes/{{node_id}}/?reserve_ip_required=&reserve_ip_pool_required=&apikey={{api_key&project_id=2157&location=Delhi' \
-X 'DELETE' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: en-gb' \
-H 'Authorization: Bearer {{token}}'
-H 'Content-Type: application/json' \
-H 'Origin: https://myaccount.e2enetworks.com' \
-H 'Pragma: no-cache' \
-H 'Referer: https://myaccount.e2enetworks.com/' \
-H 'x-api-key: 9d5383a1-69e3-4871-b32c-6bb8ad882000' \
--compressed
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
content-type: application/json; charset=utf-8
status: 202 Accepted
ratelimit-limit: 1200
ratelimit-remaining: 965
ratelimit-reset: 1415984218
{
"message": "Success",
"code": 200,
"data": {},
"errors": {}
}
Update Committed Node Plan
Endpoint:
https://api.e2enetworks.com/myaccount/api/v1/update_committed_node_status/?apikey={{api_key}}&project_id={{project_id}}
Request Parameter:
Name |
Type |
Description |
Required |
---|---|---|---|
vcn_id |
Integer |
Node id of customer |
True |
node_status |
String |
Values should be auto_renew auto_terminate hourly_billing In auto_renew case, user can pass committed_plan |
True |
committed_plan |
Integer |
committed_sku_id of plan |
False |
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.e2enetworks.com/myaccount/api/v1/update_committed_node_status/?apikey={{api_key}}&project_id={{project-id}}',
'headers': {
'Content-Type': 'application/json',
'Cookie': 'csrftoken=EURP4T2iPrftapU6gjAauT7arLzsirOr5t1M1moLgftZDPzM5NEozeVzX43LydVN; sessionid=4h7le9486eesvz70yfppeh02qzwevekn; customer_role_auth=eyJpc19zdGFuZF9hbG9uZV9jdXN0b21lciI6IHRydWUsICJpc19wYXJ0bmVyIjogZmFsc2UsICJpc19wYXJ0bmVyX2N1c3RvbWVyIjogZmFsc2UsICJpc19yb2xlX2VuYWJsZWQiOiB0cnVlLCAiaGlkZV9iaWxsaW5nX2J5X3JvbGUiOiBmYWxzZSwgImlzX3JvbGVfc3VzcGVuZGVkIjogZmFsc2UsICJpc19jdXN0b21lcl9hY3RpdmUiOiB0cnVlLCAiaXNfdmVyaWZpZWQiOiB0cnVlLCAiaXNfc3VzcGVuZGVkIjogZmFsc2V9'
},
body: JSON.stringify({"vcn_id":56778,"node_status":"auto_terminate","committed_plan":0})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
curl 'https://api.e2enetworks.com/myaccount/api/v1/nodes/{{node_id}}/actions/?apikey={{api_key}}&project_id={{project_id}}&location=Delhi' \
--header 'Accept: application/json, text/plain, */*' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{api_key}}' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1dHVydmVkaSIsImVtYWlsIjoic2h1YmhhbS5jaGF0dXJ2ZWRpQGUyZW5ldHdvcmtzLmNvbCrfm2-YC_bhbp2O5IX2XAkJjqlqleyGpiwyUGfCq1y1M' \
--data '{
"sku_day_id": 229
}'