01-16-2025 08:55 AM
We are looking into some devices on our meraki network.
We have a solution or dev custom code to assign a specific device on the network to a sepcific work center location in our shop floor.
Basically I want to use a cisco meraki API to kind the device name devicexyz and find which port on the switch it is plugged into and return the Name of the port which is workcenterXXX
Our devices are issued DHCP reserved so the IP and the Name stay the same of the device, just may move from workcenter001 to say workcenter003 would be nice if we can build a python or vbs script to call a cisco api, identify the port, pull the description of that port and then populate an internal variable with that info. We can can then check that variable and assign the device deviccexyz to workcenter003.
I was carusing the API and seems there might be a way to do this but wanted to have some input from anyone else that might have done it.
01-16-2025 09:19 AM
@jpliss It would be best to start at the org level, and then continue drill down to find your specific device, then get its connection details to identify which port it's connected to, in your case the key is rour switch port names/descriptions need to contain the workcenter information (like "workcenter001") for this to work, based on what you have described.
Look at the following API, docs are here https://developer.cisco.com/meraki/api-v1/ - these are all GET requests
/organizations/{organizationId}/networks
Gets all networks in your organizationnetworks/{networkId}/clients
Lists all devices (clients) connected to each network to find your target device/networks/{networkId}/clients/{clientId}
Once you find your device, get its detailed connection info including which switch it's connected to/devices/{serial}/switch/ports
Using the switch's serial number, get all port information including port names/descriptions that contain your workcenter locationsHope this helps.
01-16-2025 01:38 PM - edited 01-16-2025 01:39 PM
Yes we have descriptions of each port associated to the workcenter.
IE switch stack1 switch 1 port 01 has a desription of workcenter001ws
IE switch stack1 switch 1 port 02 has a desription of workcenter001lbl
IE switch stack1 switch 1 port 03 has a desription of workcenter001rbo
IE switch stack1 switch 1 port 04 has a desription of workcenter001cam
So based on your response this is possible.
01-17-2025 02:13 AM
@jpliss yes as you have well structured port descriptions with the workcenter information embedded in them this will be good.
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