cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Having Error While Updating Switchport API

SOLVED
Conversationalist

Having Error While Updating Switchport API

I have been trying to update a switch port with the following json file however is keep giving me a error.

{"name": "Test1", "tags": "null", "enabled": true, "poeEnabled": true, "type": "access", "vlan": 10, "voiceVlan": null, "allowedVlans": "all", "isolationEnabled": false, "rstpEnabled": true, "stpGuard": "disabled", "accessPolicyNumber": null, "linkNegotiation": "Auto negotiate", "portScheduleId": null, "udld": "Alert only", "macWhitelist": ["34:56:fe:ce:8e:b0", "34:56:fe:ce:8e:b1"] }

 


Only one of access policy, MAC whitelist and Sticky whitelist may be specified

 

MAC whitelist and Sticky whitelist may be specified but there no field of this two field in the data model

Any advise is welcome

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Kind of a big deal

Re: Having Error While Updating Switchport API

Remove all null entries. I just had to do this for a client.

 

If you want to whack it in Python:

 

 

empties = []
for key, value in port.items():
    if value == None:
        empties.append(key)
for item in empties:
    try:
        port.pop(item)
    except:
        print(f"Couldn't pop {item}")
putSwitchport(arg_apikey, arg_serial, port, switchportNum, shard)

 

5 REPLIES 5
Kind of a big deal

Re: Having Error While Updating Switchport API

Isn't it called "stickyMacWhitelist" instead of "macWhitelist"?

 

See in the example in the docs here:

https://documenter.getpostman.com/view/7928889/SVmsVg6K?version=latest#d3edbb74-e6f6-4dc2-99f7-a6289...

 

Edit: Both are actually valid options.

Conversationalist

Re: Having Error While Updating Switchport API

Both fieldname have been tested however it still give the same error for us to select one of those 2 access policy

Kind of a big deal

Re: Having Error While Updating Switchport API

Try removing the "accessPolicyNumber": null line.

Highlighted
Kind of a big deal

Re: Having Error While Updating Switchport API

Remove all null entries. I just had to do this for a client.

 

If you want to whack it in Python:

 

 

empties = []
for key, value in port.items():
    if value == None:
        empties.append(key)
for item in empties:
    try:
        port.pop(item)
    except:
        print(f"Couldn't pop {item}")
putSwitchport(arg_apikey, arg_serial, port, switchportNum, shard)

 

Kind of a big deal

Re: Having Error While Updating Switchport API

BTW, after discussing this with @BrechtSchamp I realized I forgot to say - if you need to _set_ a field as null, make sure it's specifically included.

 

But if it's already null and will remain null, you can remove the key:value pair.

Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.