Hello I think what you are trying to do is apply the same tags for the admin and that one applies to a specific switchport if that is the case you need to do this: Step 1: update or add a tag to the existing network Step 2: update or add that tag to a specific admin org Step 3 update or add that tag to a specific switch port if that is correct here is the python code: import meraki
def addNetworkTag(apiKey, networkId, tag):
try:
#Step 1
#Add tag to the existing network
#https://developer.cisco.com/meraki/api-latest/#!update-network
dashboard = meraki.DashboardAPI(apiKey)
network_id = networkId
response = dashboard.networks.updateNetwork(
network_id,
tags=[tag],
)
print(response)
except meraki.APIError as e:
print(e)
addNetworkTag()
except KeyboardInterrupt:
print()
print(" -- Program terminated manually --")
print(" Goodbye! ")
quit()
def updateOrgAdmin(apiKey, organizationId, adminId, tag):
try:
# Step 2
# Add network tag to admins
#https://developer.cisco.com/meraki/api-latest/#!update-organization-admin
dashboard = meraki.DashboardAPI(apiKey)
organization_id = organizationId
admin_id = adminId
response = dashboard.organizations.updateOrganizationAdmin(
organization_id, admin_id,
tags=[{'tag': tag, 'access': 'full'}]
)
print(response)
except meraki.APIError as e:
print(e)
except KeyboardInterrupt:
print()
print(" -- Program terminated manually --")
print(" Goodbye! ")
quit()
def addTagtoPorts(apiKey, switchSerial, switchPort, tag):
#Step 3
#Add the Network Tag to a specific SW port
#https://developer.cisco.com/meraki/api-latest/#!update-device-switch-port
try:
dashboard = meraki.DashboardAPI(apiKey)
serial = switchSerial
port_id = switchPort
response = dashboard.switch.updateDeviceSwitchPort(
serial, port_id,
tags=[tag]
)
print(response)
except meraki.APIError as e:
print(e)
except KeyboardInterrupt:
print()
print(" -- Program terminated manually --")
print(" Goodbye! ")
quit()
#Variables needed
apiKey = "<Your API Key>"
tag = "<Desire Tag for everyone>"
organizationId = "<Org id>"
adminId = "<admin id>"
networkId = "<Desired Network id>"
switchSerial = "<sw serial number>"
switchPort = "<desire sw port>"
"""Program starts here"""
# Step1
addNetworkTag(apiKey)
# Step2
updateOrgAdmin(apiKey)
#Step3
addTagtoPorts(apiKey) hope that work for you!
... View more