03-26-2025 02:47 AM
Hi folks,
I'm struggeling a bit with getOrganizationSwitchPortsBySwitch API endpoint.
https://developer.cisco.com/meraki/api-v1/get-organization-switch-ports-by-switch/
It does include mostly all configuration parameters of switch ports. But for reasons I do not understand UDLD configuration is not included. To get UDLD config, I must use inefficient getDeviceSwitchPort in addition.
Does anybody here know why UDLD config has been excluded?!? Are there any plans to add it?
Kind regards,
Oliver Buchholz
Solved! Go to Solution.
03-27-2025 05:11 AM
import os
import json
import requests
api_key = os.environ.get('MERAKI_DASHBOARD_API_KEY')
org_id:str = 'xxxx'
serial:str = 'xxxx'
url:str = "https://api.meraki.com/api/v1/organizations/{org_id}/switch/ports/bySwitch?extendedParams=True"
headers:dict = {
'X-Cisco-Meraki-API-Key' : api_key,
'Content-Type': 'application/json'
}
response = requests.request('GET', url, headers=headers, data="", timeout=60)
print(response.text.encode('utf8'))Simple as that. You might need to enable API beta program through the early access tab from your org.
03-26-2025 04:55 AM
Hi ,
Have you tested with extendedParams=True ?
03-26-2025 05:25 AM
Hi Raphael,
I'm not aware of an "extendedParams" parameter and could not find it on the documentation either. Where should I add it, to the getOrganizationSwitchPortsBySwitch request? This does not change anything on the reply.
Here's an example output for one port. It does not contain UDLD:
{
'portId': '2',
'name': 'Test',
'tags': ['test'],
'enabled': True,
'poeEnabled': True,
'type': 'access',
'vlan': 1,
'voiceVlan': 2,
'allowedVlans': 'all',
'rstpEnabled': True,
'stpGuard': 'bpdu guard',
'linkNegotiation': 'Auto negotiate',
'accessPolicyType': 'Open'
}Kind regards,
Oliver
03-26-2025 06:08 AM
{
"portId": "1",
"name": null,
"tags": [],
"enabled": true,
"poeEnabled": true,
"type": "access",
"vlan": 1022,
"voiceVlan": 1035,
"allowedVlans": "all",
"rstpEnabled": true,
"stpGuard": "bpdu guard",
"linkNegotiation": "Auto negotiate",
"accessPolicyType": "Custom access policy",
"accessPolicyNumber": 3
}With :
03-26-2025 08:07 AM
Hi Raphael,
I still did not get where to add the extendedParams. Here's a sample code:
import os
import meraki
import meraki.exceptions
debug: bool = False
api_key = os.environ.get('MERAKI_DASHBOARD_API_KEY')
org_id:str = 'xxxx'
serial:str = 'xxxx'
dashboard: meraki.DashboardAPI = meraki.DashboardAPI(
api_key=api_key,
log_path='',
output_log=debug,
print_console=debug,
suppress_logging=not debug)
all_ports_config:list = dashboard.switch.getOrganizationSwitchPortsBySwitch(
org_id,
extendedParam=True,
total_pages=-1,
serial=serial
)
print(all_ports_config[0]['ports'][0])Where do I have to add the extendedParams=True?
Kind regards,
Oliver
03-26-2025 09:55 AM
I don't use the Meraki SDK but I would assume right where you already have it , but without the typo.
extendedParams
03-27-2025 12:50 AM
Hi Raphael,
sorry to bother you again, but I do not get it working. I've tried it with "extendedParams" with same result.
Now I've created another sample code without Meraki SDK, but same result again.
import os
import json
import requests
api_key = os.environ.get('MERAKI_DASHBOARD_API_KEY')
org_id:str = 'xxxx'
serial:str = 'xxxx'
url:str = "https://api.meraki.com/api/v1/organizations/{org_id}/switch/ports/bySwitch"
headers:dict = {
'X-Cisco-Meraki-API-Key' : api_key,
'Content-Type': 'application/json'
}
payload:str = json.dumps(
{
"extendedParams": True,
"serial": serial
}
)
response = requests.request('GET', url, headers=headers, data=payload, timeout=60)
print(response.text.encode('utf8'))Do you have a working example for me?
Kind regards,
Oliver
03-27-2025 05:11 AM
import os
import json
import requests
api_key = os.environ.get('MERAKI_DASHBOARD_API_KEY')
org_id:str = 'xxxx'
serial:str = 'xxxx'
url:str = "https://api.meraki.com/api/v1/organizations/{org_id}/switch/ports/bySwitch?extendedParams=True"
headers:dict = {
'X-Cisco-Meraki-API-Key' : api_key,
'Content-Type': 'application/json'
}
response = requests.request('GET', url, headers=headers, data="", timeout=60)
print(response.text.encode('utf8'))Simple as that. You might need to enable API beta program through the early access tab from your org.
03-27-2025 06:40 AM
Hi Raphael,
API beta with early access was making the difference! Thanks for your help!
Kind regards,
Oliver
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide