Perhaps this was done already but I'm looking for an API that can retrieve network id with a given MAC or IP address (WAN/LAN) in organization? Is there such an API?
Thanks in advance!
Nope, that API endpoint does not exist.
You'd have to grab every device in the Org (https://api.meraki.com/api_docs#return-the-inventory-for-an-organization) and then grab every client for each device (https://api.meraki.com/api_docs#list-the-clients-of-a-device-up-to-a-maximum-of-a-month-ago) until you find it.
Or, you could grab every network in an Org (https://api.meraki.com/api_docs#list-the-networks-in-an-organization) and then list every client in each network (https://api.meraki.com/api_docs#list-the-clients-that-have-used-this-network-in-the-timespan) until you find your client.
I can confirm this does work utilising the method from @jdsilva I have created a script in powershell that does this but as stated it takes a long time to process.. Which is possibly the way my script is written but it works for searching for mac's at least. I search org > network > device then search for clients on the security appliance. We do have 350 sites to search through. You can take that as a basis on whether it is worth setting up. It has allowed us to find some user's who were serial bandwidth hogs and locate which sites they had been to.
First of all, thanks to everyone's response.
I used Postman to send "API" request to get network information such as networks, devices, static routes, etc. My question: is it possible to create/ build / scripting an API (using Postman if possible) to obtain network id info with a given known IP/MAC address within organization? Hope it clear...
This is an older piece of code but should get you what you need.
Thanks @Steinbep . With my very limited knowledge of python I think your recommendation of python script may work. now I gotta go to figure out how to run a python script which i'd never done it before 🙂 .
@dbd @it will work. It’s what I use. You just need the api key.
And org id. You can run this from idle or any other ide you want.