Reserve IP¶
Create an API Key and access token:-¶
For create a API Key and Access Token to refer this link :-
https://www.e2enetworks.com/help/knowledge-base/how-to-create-an-api-access-token/
List of Reserve IP-¶
To find a list of Reserve IP to send a GET request
https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/?apikey=a8e867bf-00a6-43aa-86e3-392ece8dfebb&location=Delhi
The request returns a JSON object that contains the following attributes:
PYTHON¶
1. Python - http.client Example
import http.client
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
'Authorization': 'API_Token ',
}
conn.request("GET", "/myaccount/api/v1/reserve_ips/?apikey={{API_Key}}&location=Delhi", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
2. Python - Requests Example
import requests
url = "https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/?apikey={{API_Key}}&location=Delhi"
payload={}
headers = {
'Authorization': 'API_Token',
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
Headers¶
Request Headers¶
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
Response Headers:-¶
content-type: application/json; charset=utf-8
status: 202 Accepted
Body¶
Response Body¶
{
"code": 200,
"data": [
{
"ip_address": "216.48.189.38",
"status": "Available",
"bought_at": "24-02-2022 08:31",
"vm_id": null,
"vm_name": "--",
"reserve_id": 4558,
"appliance_type": "--"
},
],
"errors": {},
"message": "Success",
"is_limit_available": true,
"reserved_ip_details": {
"customer_max_limit": 3,
"reserved_ips_count": 2
},
"reserve_ip_price": "199 infra credits"
}
Create a new Reserve IP¶
To create a Reserve IP to send a Post request
https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/?apikey=a8e867bf-00a6-43aa-86e3-392ece8dfebb&location=Delhi
The request returns a JSON object that contains the following attributes:
Name | Type | Description |
---|---|---|
ip_address | Integer | Information regarding the network configuration. |
vm_id | Integer | A unique integer identifier created and assigned to the node after its creation. |
vm_name | String | The name assigned to the node. |
reserve_id | Integer | A unique integer identifier created and assigned to the reserve ip after its creation. |
bought_at | Integer | A string represents both the date and time when the reserve ip is created. |
status | string | A string that denotes the state of the Reserve ip. |
cutomer_max_limit | Integer | |
reserved_ips_count | Integer |
PYTHON¶
1. Python - http.client Example
import http.client
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
'Authorization': 'API_Token ',
'Content-Type': 'application/json',
}
conn.request("POST", "/myaccount/api/v1/reserve_ips/?apikey={{API_Key}}&location=Delhi", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
2. Python - Requests Example
import requests
url = "https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/?apikey={{API_Key}}&location=Delhi"
payload={}
headers = {
'Authorization': 'API_Token ',
'Content-Type': 'application/json',
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Headers¶
Request Headers¶
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
Response Headers:-¶
content-type: application/json; charset=utf-8
status: 202 Accepted
Body¶
Response Body¶
{
"code": 200,
"data": {
"ip_address": "216.48.189.51",
"status": "Available",
"bought_at": "25-02-2022 03:07",
"vm_id": null,
"vm_name": "--",
"reserve_id": 4575,
"appliance_type": "--"
},
"errors": {},
"message": "Success",
"is_limit_available": false,
"reserved_ip_details": {
"customer_max_limit": 3,
"reserved_ips_count": 3
},
"reserve_ip_price": "199 infra credits"
}
Delete Reserve IP¶
To delete a Reserve IP to send a DELETE request
https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/216.48.189.29/actions/?apikey=a8e867bf-00a6-43aa-86e3-392ece8dfebb&location=Delhi
PYTHON¶
1. Python - http.client Example
import http.client
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
'Authorization': 'API_Token ',
'Content-Type': 'application/json',
}
conn.request("DELETE", "/myaccount/api/v1/reserve_ips/{{ip_address}}/actions/?apikey={{API_Key&location=Delhi", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
2. Python - Requests Example
import requests
url = "https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/{{ip_address}}/actions/?apikey={{Api_key}}&location=Delhi"
payload={}
headers = {
'Authorization': 'API_Token ',
'Content-Type': 'application/json',
}
response = requests.request("DELETE", url, headers=headers, data=payload)
print(response.text)
Attached to Node¶
Attach Reserve IP through node to send a POST request
https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/101.53.135.29/actions/?apikey=a8e867bf-00a6-43aa-86e3-392ece8dfebb&location=Delhi
Attributes and respective values required to send this POST request are:
Name | Type | Description | Required |
---|---|---|---|
type | string | A string that denotes the type:“Attach” or “Detach” | True |
vm_id | integer | A unique integer identifier created and assigned to the node after its creation. | True |
The request returns a JSON object that contains the following attributes:
Name | Type | Description |
---|---|---|
ip_address | Integer | Information regarding the network configuration. |
vm_id | Integer | A unique integer identifier created and assigned to the node after its creation. |
vm_name | String | The name assigned to the node. |
status | string | A string that denotes the state of the Reserve ip. |
PYTHON¶
1. Python - http.client Example
import http.client
import json
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"type": "attach",
"vm_id": 99321
})
headers = {
'Authorization': 'api_token ',
'Content-Type': 'application/json',
conn.request("POST", "/myaccount/api/v1/reserve_ips/{{ip_adress}}/actions/?apikey={{api_key}}&location=Delhi", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
2. Python - Requests Example
import requests
import json
url = "https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/{{ip_adderess}}/actions/?apikey={{api_key}}&location=Delhi"
payload = json.dumps({
"type": "attach",
"vm_id": 99321
})
headers = {
'Authorization': 'API_Token ',
'Content-Type': 'application/json',
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Detach Reserve IP from Node¶
Detach Reserve IP through node to send a Post request
https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/101.53.135.29/actions/?apikey=a8e867bf-00a6-43aa-86e3-392ece8dfebb&location=Delhi
Attributes and respective values required to send this POST request are:
Name | Type | Description | Required |
---|---|---|---|
type | string | A string that denotes the type:“Attach” or “Detach” | True |
vm_id | integer | A unique integer identifier created and assigned to the node after its creation. | True |
The request returns a JSON object that contains the following attributes:
Name | Type | Description |
---|---|---|
ip_address | Integer | Information regarding the network configuration. |
vm_id | Integer | A unique integer identifier created and assigned to the node after its creation. |
vm_name | String | The name assigned to the node. |
status | string | A string that denotes the state of the Reserve ip. |
PYTHON¶
1. Python - http.client Example
import http.client
import json
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"type": "detach",
"vm_id": 99321
})
headers = {
'Authorization': 'API_Token ',
'Content-Type': 'application/json',
}
conn.request("POST", "/myaccount/api/v1/reserve_ips/{{ip_adress}}/actions/?apikey={{api_key}}&location=Delhi", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
2. Python - Requests Example
import requests
import json
url = "https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/{{ip_adress}}/actions/?apikey={{api_key}}&location=Delhi"
payload = json.dumps({
"type": "detach",
"vm_id": 99321
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Headers¶
Request Headers¶
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
Response Headers:-¶
content-type: application/json; charset=utf-8
status: 202 Accepted
Body¶
Request Body¶
{
"type":"detach",
"vm_id":99321
}
Response Body¶
{
"code": 200,
"data": {
"IP": "101.53.135.29",
"status": "Available",
"vm_name": "--"
},
"errors": {},
"message": "IP Detach Successfully."
}
Attached Reserve IP to Load Balancer¶
Attach Reserve IP through Load Balancer to send a Post request
https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/216.48.189.41/actions/?apikey=9589eb35-b2bd-4c3f-8fdc-c2f05b899528&location=Delhi
Attributes and respective values required to send this POST request are:
Name | Type | Description | Required |
---|---|---|---|
type | string | A string that denotes the type:“Attach” or “Detach” | True |
vm_id | integer | A unique integer identifier created and assigned to the node after its creation. | True |
The request returns a JSON object that contains the following attributes:
Name Type Description ip_address Integer Information regarding the network configuration. vm_id Integer A unique integer identifier created and assigned to the node after its creation. vm_name String The name assigned to the node. status string A string that denotes the state of the Reserve ip.
PYTHON¶
1. Python - http.client Example
import http.client
import json
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"type": "attach",
"vm_id": 99769
})
headers = {
'Authorization': 'API_Token ',
'Content-Type': 'application/json',
}
conn.request("POST", "/myaccount/api/v1/reserve_ips/{{ip_address}}/actions/?apikey={{api_key}}&location=Delhi", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
2. Python - Requests Example
import requests
import json
url = "https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/{{ip_address}}/actions/?apikey={{api_key}}&location=Delhi"
payload = json.dumps({
"type": "attach",
"vm_id": 99769
})
headers = {
'Authorization': 'api_token ',
'Content-Type': 'application/json',
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Headers¶
Request Headers¶
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
Response Headers:-¶
content-type: application/json; charset=utf-8
status: 202 Accepted
Body¶
Request Body¶
{
"type":"attach",
"vm_id":99769
}
Response Body¶
{
"code": 200,
"data": {
"IP": "216.48.189.41",
"status": "Attached",
"vm_name": "E2E-LB-1-446",
"vm_id": 99769
},
"errors": {},
"message": "IP assign successfully "
}
Detach Reserve IP to Load Balancer¶
Detach Reserve IP through Load Balancer to send a Post request
https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/216.48.189.41/actions/?apikey=9589eb35-b2bd-4c3f-8fdc-c2f05b899528&location=Delhi
Attributes and respective values required to send this POST request are:
Name | Type | Description | Required |
---|---|---|---|
type | string | A string that denotes the type:“Attach” or “Detach” | True |
vm_id | integer | A unique integer identifier created and assigned to the node after its creation. | True |
The request returns a JSON object that contains the following attributes:
Name | Type | Description |
---|---|---|
ip_address | Integer | Information regarding the network configuration. |
vm_id | Integer | A unique integer identifier created and assigned to the node after its creation. |
vm_name | String | The name assigned to the node. |
status | string | A string that denotes the state of the Reserve ip. |
PYTHON¶
1. Python - http.client Example
import http.client
import json
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"type": "detach",
"vm_id": 99006
})
headers = {
'Authorization': 'api_token ',
'Content-Type': 'application/json',
}
conn.request("POST", "/myaccount/api/v1/reserve_ips/{{ip_address}}/actions/?apikey={{api_key}}&location=Delhi", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
2. Python - Requests Example
import requests
import json
url = "https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/{{ip_address}}/actions/?apikey={{api_key}}&location=Delhi"
headers = {
'Authorization': 'api_token ',
'Content-Type': 'application/json',
}
payload = json.dumps({
"type": "detach",
"vm_id": 99006
})
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Headers¶
Request Headers¶
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
Response Headers:-¶
content-type: application/json; charset=utf-8
status: 202 Accepted
Body¶
Request Body¶
{
"type":"attach",
"vm_id":99769
}
Response Body¶
{
"code": 200,
"data": {
"IP": "216.48.189.41",
"status": "Available",
"vm_name": "--"
},
"errors": {},
"message": "IP Detach Successfully."
}