We have been trying to update the name server for VLANs using Python through the API but have been getting errors or issues We can update using the GUI without issue but the idea is to do this in mass (we cannot use templates) the setting is under Security & SD WAN > Configure > DHCP our first attempt looks like this import meraki from getpass import getpass TARGET_NETWORK_NAME = "INSET NAME HERE " VLANS_TO_UPDATE = [10, 11] NEW_DNS = "1.1.1.1,8.8.8.8" def main(): API_KEY = getpass("Enter your Meraki API Key: ").strip() dashboard = meraki.DashboardAPI(api_key=API_KEY, print_console=False) org_id = dashboard.organizations.getOrganizations()[0]["id"] networks = dashboard.organizations.getOrganizationNetworks( org_id, total_pages='all' ) net = next((n for n in networks if n["name"] == TARGET_NETWORK_NAME), None) if not net: print("Network not found") return net_id = net["id"] for vlan_id in VLANS_TO_UPDATE: print(f"\nReading VLAN {vlan_id}...") vlan = dashboard.appliance.getNetworkApplianceVlan(net_id, vlan_id) print("Current DNS:", vlan.get("dnsNameservers")) confirm = input("\nProceed with DNS update? (yes/no): ").lower() if confirm not in ("yes", "y"): return for vlan_id in VLANS_TO_UPDATE: print(f"\nUpdating VLAN {vlan_id}...") # MUST include required fields vlan = dashboard.appliance.getNetworkApplianceVlan(net_id, vlan_id) payload = { "name": vlan["name"], "subnet": vlan["subnet"], "applianceIp": vlan["applianceIp"], "dhcpHandling": vlan["dhcpHandling"], "dhcpLeaseTime": vlan["dhcpLeaseTime"], "dhcpBootOptionsEnabled": vlan["dhcpBootOptionsEnabled"], "dhcpOptions": vlan["dhcpOptions"], "dnsNameservers": NEW_DNS, # legacy format uses this field } print("Payload:", payload) try: dashboard.appliance.updateNetworkApplianceVlan( net_id, vlan_id, **payload ) print(f"Updated VLAN {vlan_id}") except Exception as e: print(f"Update failed for VLAN {vlan_id}: {e}") if __name__ == "__main__": main() but results in Enter your Meraki API Key: Reading VLAN 10... Current DNS: HIDDEN HIDDEN Reading VLAN 11... Current DNS: HIDDEN HIDDEN Proceed with DNS update? (yes/no): yes Updating VLAN 10... Payload: {'name': 'POS-PCI', 'subnet': 'HIDDEN', 'applianceIp': 'HIDDEN', 'dhcpHandling': 'Run a DHCP server', 'dhcpLeaseTime': '1 day', 'dhcpBootOptionsEnabled': False, 'dhcpOptions': [], 'dnsNameservers': '8.8.8.8,1.1.1.1'} Update failed for VLAN 10: appliance, updateNetworkApplianceVlan - 400 Bad Request, {'errors': ['The Custom nameservers list contains one or more invalid entries (should be IP addresses or domain names).']}
... View more