cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Bookmark
|
Subscribe
|
333
Views
0
Helpful
3
Replies

Cisco API question

jpliss
Level 1
Level 1

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.

3 Replies 3

@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 organization
  • networks/{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 locations

Hope this helps.

 

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

jpliss
Level 1
Level 1

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.

 

@jpliss yes as you have well structured port descriptions with the workcenter information embedded in them this will be good.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io