===== DBaas ===== 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 DbaaS- ============== To find a list of **DBaaS**, send a **GET** request: .. code-block:: bash https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/?apikey={api_key} &location=Delhi&project_id={{project-id}} The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Name - Type - Description * - public_ip_address - Integer - Information regarding the network configuration. * - id - Integer - A unique integer identifier created and assigned to the Databsase after its creation. * - name - string - The name assigned to the databsase. * - username - string - The username assigned to the databsase when it’s created. * - created_at - Integer - A string represents both the date and time when the Dbaas is created. * - status - string - A string that denotes the status of the Databsase. * - private_ip_address - Integer - Information regarding the network configuration. * - vm_id - Integer - A unique integer identifier created and assigned to the Databsase after its creation. * - node_id - Integer - A unique integer identifier created and assigned to the Databsase after its creation * - cluster_id - Integer - A unique integer identifier created and assigned to the Databsase after its creation .. tabs:: .. code-tab:: python Http Client Method import http.client conn = http.client.HTTPSConnection("api.e2enetworks.com") payload = '' headers = { 'Authorization': 'api_token ', } conn.request("GET", "/myaccount/api/v1/rds/cluster/?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 Requests Method import requests url = "https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/?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 { "code": 200, "data": [ { "id": 775, "name": "name_of_DB", "status": "RUNNING", "status_title": "Running", "status_actions": [ "delete", "stop", "restart", "manual-snapshot", "restore-snapshot" ], "num_instances": 1, "software": { "name": "MySQL", "version": "5.6", "engine": "Innodb" }, "master_node": { "instance_id": 1443, "cluster_id": 775, "node_id": 91319, "vm_id": 102182, "port": "3306", "public_ip_address": "164.52.209.3", "private_ip_address": "172.16.119.199", "allowed_ip_address": { "whitelisted_ips": [], "temp_ips": [], "whitelisting_in_progress": false }, "zabbix_host_id": 94885, "databsase": { "id": 775, "username": "Username", "databsase": "name_of_DB", "pg_detail": {} }, "ram": "8 GB", "cpu": "2", "disk": "100 GB", "status": "Running", "db_status": "Running", "created_at": "05/Apr/2022 03:43 PM", "plan": { "name": "DBS.8GB_MySQL_56", "price": "Rs 4/Hour or Rs 2920 Monthly", "template_id": 27, "ram": "8", "cpu": "2", "disk": "100" } }, "connectivity_detail": "{'read_end_point': [{'ip': '164.52.209.3', 'port': 3307}, {'ip': '172.16.119.199', 'port': 3307}], 'read_and_write_end_point': [{'ip': '164.52.209.3', 'port': 3306}, {'ip': '172.16.119.199', 'port': 3306}], 'status': 'updated', 'type': 1}" } ], "errors": {}, "message": "Success" } Create a new DbaaS- ------------------- To create a **DbaaS** to send a **Post** request- .. code-block:: bash https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/?apikey={api_key} &location=Delhi&project_id={{project-id}} Attributes and respective values required to send this POST request are: .. list-table:: :widths: 25 25 60 10 :header-rows: 1 * - Name - Type - Description - Required * - password - char - Assigned the password to the databsase. - True * - Name - string - The name assigned to the Databsase. - True * - user - string - Assign the user name to the databsase - True The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Name - Type - Description * - public_ip_address - Integer - Information regarding the network configuration. * - id - Integer - A unique integer identifier created and assigned to the Databsase after its creation. * - name - string - The name assigned to the databsase. * - username - string - The username assigned to the databsase when it’s created. * - created_at - Integer - A string represents both the date and time when the Dbaas is created. * - status - string - A string that denotes the status of the Databsase. * - private_ip_address - Integer - Information regarding the network configuration. * - vm_id - Integer - A unique integer identifier created and assigned to the Databsase after its creation. * - node_id - Integer - A unique integer identifier created and assigned to the Databsase after its creation * - cluster_id - Integer - A unique integer identifier created and assigned to the Databsase after its creation .. tabs:: .. code-tab:: Python Http Client Method import http.client import json conn = http.client.HTTPSConnection("api.e2enetworks.com") payload = json.dumps({ "databsase": { "name": "nameofdatabsase", "password": "Password123@", "user": "username" }, "group": "Default", "name": "nameofdatabsase", "software_id": 2, "template_id": 27 }) headers = { 'Authorization': 'API_Token ', 'Content-Type': 'application/json', } conn.request("POST", "/myaccount/api/v1/rds/cluster/?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 Requests Method import requests import json url = "https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/?apikey={{api_key}}&location=Delhi&project_id={{project-id}}" payload = json.dumps({ "databsase": { "name": "nameofdatabsase", "password": "Password123@", "user": "username" }, "group": "Default", "name": "username", "software_id": 2, "template_id": 27 }) 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:: Request Body { "databsase": { "name": "nameofdb", "password": "Password@123", "user": "provideusername" }, "group": "Default", "name": "nameofdb", "software_id": 2, "template_id": 27 } .. code-tab:: Response Body { "code": 200, "data": { "id": 780, "name": "name_of_DB", "status": "CREATING", "status_title": "Creating", "status_actions": [ "delete" ], "num_instances": 1, "software": { "name": "MySQL", "version": "5.6", "engine": "Innodb" }, "master_node": { "instance_id": 1453, "cluster_id": 780, "node_id": 91686, "vm_id": 102560, "port": "3306", "public_ip_address": "164.52.209.187", "private_ip_address": "172.16.112.40", "allowed_ip_address": { "whitelisted_ips": [], "temp_ips": [], "whitelisting_in_progress": false }, "zabbix_host_id": null, "databsase": { "id": 780, "username": "Provide_username", "databsase": "Name_of_DB", "pg_detail": {} }, "ram": "8 GB", "cpu": "2", "disk": "100 GB", "status": "Creating", "db_status": "Creating", "created_at": "11/Apr/2022 12:29 PM", "plan": { "name": "DBS.8GB_MySQL_56", "price": "Rs 4/Hour or Rs 2920 Monthly", "template_id": 27, "ram": "8", "cpu": "2", "disk": "100" } }, "connectivity_detail": "{'read_end_point': [], 'read_and_write_end_point': [], 'status': 'updating', 'type': 1}" }, "errors": {}, "message": "Success" } Delete a DbaaS - ---------------- To delete a **DbaaS** to send a **DELETE** request- .. code-block:: bash https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/780/?apikey={api_key} &project_id={{project-id}} The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Name - Type - Description * - name - string - The name assigned to the Databsase it’s time for creation. * - cluster_id - integer - A unique integer identifier created and assigned to the Databsase after its creation .. tabs:: .. code-tab:: Python Http Client Method import http.client conn = http.client.HTTPSConnection("api.e2enetworks.com") payload = '' headers = { 'Authorization': 'api_token ', } conn.request("DELETE", "/myaccount/api/v1/rds/cluster/{{id}}/?apikey={{api_key}}&project_id={{project-id}}", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) .. code-tab:: Python Requests Method import requests url = "https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/{{id}}/?apikey={{api_key}}&project_id={{project-id}}" payload = {} headers = { 'Authorization': 'api_token ', } response = requests.request("DELETE", 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 { "code": 200, "data": { "cluster_id": "780", "name": "Name_of_DB" }, "errors": {}, "message": "Success" } Take a Snapshot - ----------------- To **take snapshot of DbaaS** to send a **POST** request- **https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/775/snapshot?apikey={api_key}&project_id={{project-id}}** Attributes and respective values required to send this POST request are: .. list-table:: :widths: 25 25 60 10 :header-rows: 1 * - Name - Type - Description - Required * - Name - string - Name is assigned to take a snapshot - True The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Name - Type - Description * - Name - string - The name assigned to the Databsase it’s time for creation. * - cluster_id - integer - A unique integer identifier created and assigned to the Databsase after its creation * - snapshot_id - integer - A unique integer identified created and assigned when we take the snapshot * - Date - integer - It represents the date and time when we take the snapshot. .. tabs:: .. code-tab:: Python Http Client Method import http.client import json conn = http.client.HTTPSConnection("api.e2enetworks.com") payload = json.dumps({ "name": "sanap3" }) headers = { 'Authorization': 'api_token ', 'Content-Type': 'application/json', } conn.request("POST", "/myaccount/api/v1/rds/cluster/{{id}}/snapshot?apikey={{api_key}}&project_id={{project-id}}", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) .. code-tab:: Python Requests Method import requests import json url = "https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/{{id}}/snapshot?apikey={{api_key}}&project_id={{project-id}}" payload = json.dumps({ "name": "sanap3" }) headers = { 'Authorization': 'api_token ', 'Content-Type': 'application/json', } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: Response Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: Request Body { "name": "sanap3" } .. code-tab:: Response Body { "code": 200, "data": { "snapshot_id": 2, "snapshot_details": { "name": "sanap3", "date": "2022-04-11T07:13:07Z", "size": "95367", "snapshot_id": "2" }, "cluster_id": 775, "name": "name_of_db" }, "errors": {}, "message": "Manual Snapshot in Process." } Reset a Password of Databsase- ------------------------------ To **Reset a Password of DbaaS** to send a **PUT** request- **https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/775/reset-password/?apikey={api_key}&project_id={{project-id}}** Attributes and respective values required to send this POST request are: .. list-table:: :widths: 25 25 60 10 :header-rows: 1 * - Name - Type - Description - Required * - password - char - Assign the password to the databsase - True * - username - string - Provide username of the databsase - true The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Name - Type - Description * - Name - string - The name assigned to the Databsase it’s time for creation. * - cluster_id - integer - A unique integer identifier created and assigned to the Databsase after its creation .. tabs:: .. code-tab:: Python Http Client Method import http.client import json conn = http.client.HTTPSConnection("api.e2enetworks.com") payload = json.dumps({ "password": "Password@123", "username": "username" }) headers = { 'Authorization': 'Api_token', 'Content-Type': 'application/json', } conn.request("PUT", "/myaccount/api/v1/rds/cluster/{{id}}/reset-password/?apikey={{api_key}}&project_id={{project-id}}", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) .. code-tab:: Python Requests Example import requests import json url = "https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/{{id}}/reset-password/?apikey={{api_key}}&project_id={{project-id}}" payload = json.dumps({ "password": "Password@123", "username": "username" }) headers = { 'Authorization': 'Bearer ', 'Content-Type': 'application/json', } response = requests.request("PUT", 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 Request Body { "password": "Password@123", "username": "provideUsername" } .. code-tab:: Python Response Body { "code": 200, "data": { "cluster_id": "775", "name": "nameofdatabsase" }, "errors": {}, "message": "User password reset in process we will notify once password is updated." } Stop Databsase -------------- To **stop a service of Databsase** to send a **PUT** request- **https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/775/shutdown?apikey={api_key}&project_id={{project-id}}** The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Name - Type - Description * - Name - string - The name assigned to the Databsase it’s time for creation. * - cluster_id - integer - A unique integer identifier created and assigned to the Databsase after its creation .. tabs:: .. code-tab:: Python Http Client Method import http.client conn = http.client.HTTPSConnection("api.e2enetworks.com") payload = '' headers = { 'Authorization': 'Bearer ', } conn.request("PUT", "/myaccount/api/v1/rds/cluster/{{id}}/shutdown?apikey={{api_key}}", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) .. code-tab:: Python Requests Method import requests url = "https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/{{id}}/shutdown?apikey={{api_key}}&project_id={{project-id}}" payload = {} headers = { 'Authorization': 'api_token ', } response = requests.request("PUT", 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:: Response Body { "code": 200, "data": { "message": "Shutdown process started.", "cluster_id": "775", "name": "shubha" }, "errors": {}, "message": "Success" } Start Databsase --------------- To **start a service of Databsase** to send a **PUT** request- **https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/775/resume?apikey={api_key}&project_id={{project-id}}** The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Name - Type - Description * - Name - string - The name assigned to the Databsase it’s time for creation. * - cluster_id - integer - A unique integer identifier created and assigned to the Databsase after its creation PYTHON ^^^^^^ .. tabs:: .. code-tab:: Python Http Client Method import http.client conn = http.client.HTTPSConnection("api.e2enetworks.com") payload = '' headers = { 'Authorization': 'api_tokrn ', } conn.request("PUT", "/myaccount/api/v1/rds/cluster/{{id}}/resume?apikey={{api_key}}&project_id={{project-id}}", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) .. code-tab:: Python Requests Method import requests url = "https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/{{id}}/resume?apikey={{api_key}}&project_id={{project-id}}" payload = {} headers = { 'Authorization': 'api_token ', } response = requests.request("PUT", 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 { "code": 200, "data": { "message": "Resume process started.", "cluster_id": "775", "name": "nameofDatabsase" }, "errors": {}, "message": "Success" } Restart Databsase - ------------------- To **Restart a Databsase** to send a **PUT** request **https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/775/restart?apikey={api_key}&project_id={{project-id}}** The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Name - Type - Description * - Name - string - The name assigned to the Databsase it’s time for creation. * - cluster_id - integer - A unique integer identifier created and assigned to the Databsase after its creation .. tabs:: .. code-tab:: Python Http Client Method import http.client conn = http.client.HTTPSConnection("api.e2enetworks.com") payload = '' headers = { 'Authorization': 'api_token ', } conn.request("PUT", "/myaccount/api/v1/rds/cluster/{{id}}/restart?apikey={{api_key}}&project_id={{project-id}}", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) .. code-tab:: Python Requests Method import requests url = "https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/{{id}}/restart?apikey={{api_key}}&project_id={{project-id}}" payload = {} headers = { 'Authorization': 'api_token', } response = requests.request("PUT", 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 { "code": 200, "data": { "message": "Reboot process started.", "cluster_id": "775", "name": "nameofdatabsase" }, "errors": {}, "message": "Success" } Attach Parameter group to Databsase ----------------------------------- To **Attach Parameter group to Databsase** to send a **POST** request- **https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/775/parameter-group/52/add?apikey={api_key}&project_id={{project-id}}** .. tabs:: .. code-tab:: Python http.client Example import http.client conn = http.client.HTTPSConnection("api.e2enetworks.com") payload = '' headers = { 'Authorization': 'api_token', } conn.request("POST", "/myaccount/api/v1/rds/cluster/775/parameter-group/52/add?apikey={{api_key}}&project_id={{project-id}}", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) .. code-tab:: Python Requests Example import requests url = "https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/{{id}}/parameter-group/{{id}}/add?apikey={{api_key}}&project_id={{project-id}}" payload = {} headers = { 'Authorization': 'api_token', } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: Response Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: Response Body { "code": 200, "data": {}, "errors": {}, "message": "Success" } Detach Parameter group to Databsase ----------------------------------- To **Detach Parameter group to Databsase** to send a **POST** request- **https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/775/parameter-group/52/detach?apikey={api_key}&project_id={{project-id}}** .. tabs:: .. code-tab:: Python http.client import http.client conn = http.client.HTTPSConnection("api.e2enetworks.com") payload = '' headers = { 'Authorization': 'api_token', } conn.request("POST", "/myaccount/api/v1/rds/cluster/{{id}}/parameter-group/52/detach?apikey={{api_key}}&project_id={{project-id}}", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) .. code-tab:: Python Requests import requests url = "https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/{{id}}/parameter-group/52/detach?apikey={{api_key}}&project_id={{project-id}}" payload = {} headers = { 'Authorization': 'api_token', } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: Response Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: Response Body { "code": 200, "data": {}, "errors": {}, "message": "Success" } Attach VPC to Databsase ----------------------- To **Attach VPC to Databsase** to send a **POST** request- **https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/775/vpc-attach/?apikey={api_key}&location=Delhi&project_id={{project-id}}** Attributes and respective values required to send this POST request are:- .. list-table:: :widths: 25 25 60 10 :header-rows: 1 * - Name - Type - Description - Required * - action - string - A string that denotes the type: “Attach” or “Detach” - True * - network_id - integer - A unique integer identifier created and assigned to the Vpc it's time to create. - True The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Name - Type - Description * - vpc_id - Type - A unique integer identifier created and assigned to the VPC after its creation * - vpc_name - string - The name was assigned to the VPC after its creation. .. tabs:: .. code-tab:: Python http.client import http.client import json conn = http.client.HTTPSConnection("api.e2enetworks.com") payload = json.dumps({ "action": "attach", "network_id": "7218" }) headers = { 'Authorization': 'api_token', 'Content-Type': 'application/json', } conn.request("POST", "/myaccount/api/v1/rds/cluster/{{id}}/vpc-attach/?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 Requests import requests import json url = "https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/{{id}}/vpc-attach/?apikey={{api_key}}&location=Delhi&project_id={{project-id}}" payload = json.dumps({ "action": "attach", "network_id": "7218" }) 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 { "code": 200, "data": { "vpc_id": 624, "vpc_name": "VPC-236" }, "errors": {}, "message": "VPC attach operation successfully done" } Detach VPC to Databsase .. tabs:: .. code-tab:: Python http.client import http.client import json conn = http.client.HTTPSConnection("api.e2enetworks.com") payload = json.dumps({ "action": "detach", "network_id": 7218 }) headers = { 'Authorization': 'api_token', 'Content-Type': 'application/json', } conn.request("POST", "/myaccount/api/v1/rds/cluster/{{id}}/vpc-detach/?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 Requests import requests import json url = "https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/{{id}}/vpc-detach/?apikey={{api_key}}&location=Delhi&project_id={{project-id}}" payload = json.dumps({ "action": "detach", "network_id": 7218 }) headers = { 'Authorization': 'api_token', 'Content-Type': 'application/json', } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: Response Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: python Response Body { "code": 200, "data": { "vpc_id": 624, "vpc_name": "VPC-236" }, "errors": {}, "message": "VPC detach operation successfully done" }