I'm trying to update device switch ports via the Python API, but it doesn't work. So I tried the code snippet from the docs page and filled all fields with values. But I only get the Response "HTTP response not OK".
Here the Python code I copied from the Meraki Developer Hub.
Does anybody have an idea, what's the problem?
from meraki_sdk.meraki_sdk_client import MerakiSdkClient
from meraki_sdk.models.update_device_switch_port_model import UpdateDeviceSwitchPortModel
from meraki_sdk.models.udld_enum import UdldEnum
from meraki_sdk.exceptions.api_exception import APIException
x_cisco_meraki_api_key = '------ API KEY ------'
client = MerakiSdkClient(x_cisco_meraki_api_key)
switch_ports_controller = client.switch_ports
collect = {}
serial = 'Q2GW-4ZDP-xxxx'
collect['serial'] = serial
number = '20'
collect['number'] = number
update_device_switch_port = UpdateDeviceSwitchPortModel()
update_device_switch_port.name = 'Test Port'
update_device_switch_port.tags = 'test'
update_device_switch_port.enabled = True
update_device_switch_port.mtype = 'access'
update_device_switch_port.vlan = 221
update_device_switch_port.voice_vlan = 21
update_device_switch_port.allowed_vlans = 'all'
update_device_switch_port.poe_enabled = True
update_device_switch_port.isolation_enabled = False
update_device_switch_port.rstp_enabled = True
update_device_switch_port.stp_guard = 'disabled'
update_device_switch_port.access_policy_number = 1234
update_device_switch_port.link_negotiation = 'Auto negotiate'
update_device_switch_port.port_schedule_id = '1234'
update_device_switch_port.udld = UdldEnum.ENUM_ALERT_ONLY
update_device_switch_port.mac_whitelist = ['34:56:fe:ce:8e:a0']
update_device_switch_port.sticky_mac_whitelist = ['34:56:fe:ce:8e:b1']
update_device_switch_port.sticky_mac_whitelist_limit = 5
update_device_switch_port.storm_control_enabled = True
collect['update_device_switch_port'] = update_device_switch_port
try:
result = switch_ports_controller.update_device_switch_port(collect)
except APIException as e:
print(e)