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={{API_Key}}&location=Delhi&project_id={{project-id}}

The request returns a JSON object that contains the following attributes:

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&project_id={{project-id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "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={{API_Key}}&location=Delhi&project_id={{project-id}}

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

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&project_id={{project-id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
  {
  "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/{{ip_address}}/actions/?apikey={{API_Key}}&location=Delhi&project_id={{project-id}}
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&project_id={{project-id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
  "code": 200,
  "data": {
      "message": "IP Released 216.48.189.38"
  },
  "errors": {},
  "message": "Success",
  "is_limit_available": true,
  "reserved_ip_details": {
      "customer_max_limit": 3,
      "reserved_ips_count": 2
  },
  "reserve_ip_price": "199 infra credits"
}

Attached to Node

Attach Reserve IP through node to send a POST request

https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/{{ip_address}}/actions/?apikey={{API_Key}}&location=Delhi&project_id={{project-id}}

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.

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&project_id={{project-id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
  "type":"attach",
  "vm_id":99769
}

Detach Reserve IP from Node

Detach Reserve IP through node to send a Post request

https://api.e2enetworks.com/myaccount/api/v1/reserve_ips/{{ip_address}}/actions/?apikey={{API_Key}}&location=Delhi&project_id={{project-id}}

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.

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&project_id={{project-id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
  "type":"detach",
  "vm_id":99321
}

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/{{ip_address}}/actions/?apikey={{API_Key}}&location=Delhi&project_id={{project-id}}

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.

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&project_id={{project-id}}", payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
  "type":"attach",
  "vm_id":99769
}

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/{{ip_address}}/actions/?apikey={{API_Key}}&location=Delhi&project_id={{project-id}}

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.

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&project_id={{project-id}}", payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
  "type":"attach",
  "vm_id":99769
}