API request to add a new NETWORK object

Before posting something, READ the changelog, WATCH the videos, howto and provide following:
Your install is: Bare metal, ESXi, what CPU model, RAM, HD, what EVE version you have, output of the uname -a and any other info that might help us faster.

Moderator: mike

Post Reply
funtick
Posts: 1
Joined: Tue Aug 08, 2017 9:48 am

API request to add a new NETWORK object

Post by funtick » Fri Jul 22, 2022 10:47 am

Hi commuity,

I'm using EVE-NG release 2.0.3-112 and trying to add a new network to lab via API:

Code: Select all

import requests
url = "http://172.18.70.84/api/labs/user_name/104/eve.unl/networks"
payload={"count":"1","visibility":"1","name":"Net","type":"bridge","postfix":0}
headers = {
  'Cookie': 'unetlab_session=bce95412-ad99-4d7f-b12a-7394b4b2ff51'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
But getting following error message:

Code: Select all

{"code":400,"status":"fail","message":"Cannot add network to the lab (20021)."}
Can someone advice me what is wrong with request and is it even possible to add a new network via API?

p.s. same code is work to create regular router object.

Post Reply