Hi...
I had some issues as well in changing the dhcp option using python, but now it is working..
As an example i have the function i have created including the API call. It is one of my first function so a bit messy...
Anyway.... check it out.... Postman is nice to check things, but create your own organisation and add some devices to it for testing purposes.. Makes life much easier
This example changes DNS names, Creates Reservations, and changes some dhcpoptions
def Update_Site_VLAN_Project(def_network,def_vlan_id,def_subnet😞
#
# Update the network using the old info
#
param = dashboard.vlans.getNetworkVlan(network_id,def_vlan_id)
my_reservation = ""
my_lijst = []
del param['id']
del param['networkId']
#
# Change the default DNS nameservers
# Creating reservations for VLAN 500 and 600
#
if def_vlan_id == "500" or def_vlan_id == "600":
param['dnsNameservers'] = '10.24.16.151\n10.24.16.152'
ip_start_1 = calc_ip_OT_Supplier(def_subnet,"0","1")
ip_end_1 = calc_ip_OT_Supplier(def_subnet,"0","99")
ip_start_2 = calc_ip_OT_Supplier(def_subnet,"0","200")
ip_end_2 = calc_ip_OT_Supplier(def_subnet,"0","254")
my_reservation = eval("{'start': '"+ip_start_1+"', 'end': '"+ip_end_1+"', 'comment': 'IT Reserved'}")
my_lijst.append(my_reservation)
my_reservation = eval("{'start': '"+ip_start_2+"', 'end': '"+ip_end_2+"', 'comment': 'IT Reserved'}")
my_lijst.append(my_reservation)
param['reservedIpRanges'] = my_lijst
if def_vlan_id == "500":
my_lijst = []
my_lijst.append(eval("{'type': 'text', 'code': '15', 'value': 'company.org'}"))
param['dhcpOptions'] = my_lijst
#
# Adding the DHCP Options for VoIP
#
if def_vlan_id == "600":
my_lijst = []
my_lijst.append(eval("{'type': 'text', 'code': '150', 'value': '10.24.75.11,10.9.8.11'}"))
param['dhcpOptions'] = my_lijst
if def_vlan_id == "1":
#
# Adding reservation .21 to .254
#
ip_start_1 = calc_ip_OT_Supplier(def_subnet,"0","21")
ip_end_1 = calc_ip_OT_Supplier(def_subnet,"0","254")
my_reservation = eval("{'start': '"+ip_start_1+"', 'end': '"+ip_end_1+"', 'comment': 'IT Reserved'}")
my_lijst.append(my_reservation)
param['reservedIpRanges'] = my_lijst
#
# Changing subnet to routable subnet
#
my_mx_subnet = def_subnet +"/24"
param['subnet'] = my_mx_subnet
def_subnet = calc_ip_OT_Supplier(def_subnet,"0","254")
param['applianceIp'] = def_subnet
response = dashboard.vlans.updateNetworkVlan(network_id,def_vlan_id,**param)