Hi I'm trying to use API to retrieve information related to CDP and LLDP I found this document but I don't know how ti implement it:
Devices
curl -L -H 'X-Cisco-Meraki-API-Key: <key>' -H 'Content-Type: application/json' -X GET 'https://api.meraki.com/api/v0/networks/[networkId]/devices'
Successful HTTP Status: 200
[
{
"name": "My AP",
"lat": 37.4180951010362,
"lng": -122.098531723022,
"serial": "Q234-ABCD-5678",
"mac": "00:11:22:33:44:55",
"model": "MR34",
"address": "1600 Pennsylvania Ave",
"lanIp": "1.2.3.4",
"tags": " recently-added ",
"networkId": "N_24329156",
"beaconIdParams": {
"uuid": "00000000-0000-0000-0000-000000000000",
"major": 5,
"minor": 3
}
}
]
curl -L -H 'X-Cisco-Meraki-API-Key: <key>' -H 'Content-Type: application/json' -X GET 'https://api.meraki.com/api/v0/networks/[networkId]/devices/[serial]'
Successful HTTP Status: 200
{
"name": "My AP",
"lat": 37.4180951010362,
"lng": -122.098531723022,
"serial": "Q234-ABCD-5678",
"mac": "00:11:22:33:44:55",
"model": "MR34",
"address": "1600 Pennsylvania Ave",
"lanIp": "1.2.3.4",
"tags": " recently-added ",
"networkId": "N_24329156",
"beaconIdParams": {
"uuid": "00000000-0000-0000-0000-000000000000",
"major": 5,
"minor": 3
}
}
curl -L -H 'X-Cisco-Meraki-API-Key: <key>' -H 'Content-Type: application/json' -X GET 'https://api.meraki.com/api/v0/networks/[networkId]/devices/[serial]/uplink'
Successful HTTP Status: 200
[
{
"interface": "WAN 1",
"status": "Active",
"ip": "1.2.3.4",
"gateway": "1.2.3.5",
"publicIp": "123.123.123.1",
"dns": "8.8.8.8, 8.8.4.4",
"usingStaticIp": false
}
]
curl -L -H 'X-Cisco-Meraki-API-Key: <key>' -H 'Content-Type: application/json' -X PUT --data-binary '{"name":"My AP","lat":37.4180951010362,"lng":-122.098531723022,"serial":"Q234-ABCD-5678","mac":"00:11:22:33:44:55","tags":" recently-added "}' 'https://api.meraki.com/api/v0/networks/[networkId]/devices/[serial]'
Successful HTTP Status: 200
{
"name": "My AP",
"lat": 37.4180951010362,
"lng": -122.098531723022,
"serial": "Q234-ABCD-5678",
"mac": "00:11:22:33:44:55",
"model": "MR34",
"address": "1600 Pennsylvania Ave",
"lanIp": "1.2.3.4",
"tags": " recently-added ",
"networkId": "N_24329156",
"beaconIdParams": {
"uuid": "00000000-0000-0000-0000-000000000000",
"major": 5,
"minor": 3
}
}
curl -L -H 'X-Cisco-Meraki-API-Key: <key>' -H 'Content-Type: application/json' -X POST --data-binary '{"serial":"Q234-ABCD-5678"}' 'https://api.meraki.com/api/v0/networks/[networkId]/devices/claim'
Successful HTTP Status: 201
{
"name": "My AP",
"lat": 37.4180951010362,
"lng": -122.098531723022,
"serial": "Q234-ABCD-5678",
"mac": "00:11:22:33:44:55",
"model": "MR34",
"address": "1600 Pennsylvania Ave",
"lanIp": "1.2.3.4",
"tags": " recently-added ",
"networkId": "N_24329156",
"beaconIdParams": {
"uuid": "00000000-0000-0000-0000-000000000000",
"major": 5,
"minor": 3
}
}
curl -L -H 'X-Cisco-Meraki-API-Key: <key>' -H 'Content-Type: application/json' -X POST 'https://api.meraki.com/api/v0/networks/[networkId]/devices/[serial]/remove'
Successful HTTP Status: 204
{
"name": "My AP",
"lat": 37.4180951010362,
"lng": -122.098531723022,
"serial": "Q234-ABCD-5678",
"mac": "00:11:22:33:44:55",
"model": "MR34",
"address": "1600 Pennsylvania Ave",
"lanIp": "1.2.3.4",
"tags": " recently-added ",
"networkId": "N_24329156",
"beaconIdParams": {
"uuid": "00000000-0000-0000-0000-000000000000",
"major": 5,
"minor": 3
}
}
curl -L -H 'X-Cisco-Meraki-API-Key: <key>' -H 'Content-Type: application/json' -X GET 'https://api.meraki.com/api/v0/networks/[networkId]/devices/[serial]/lldp_cdp?timespan=7200'
Successful HTTP Status: 200
Solved! Go to solution.
There's a couple ways you can get data from the API. The first is using curl, like the examples in the documentation. curl is a commandline utility for interacting with URLs. It's commonly found on most *nix systems.
Postman is another popular choice for people, though I personally don't use it.
And then, of course, you can write a program using your favourite scripting or programming language to interact with the API. Everything you need for that is outlined in the documentation (though if you're not already fluent with a language this will be the most compilcated method for you).
Meraki.io is the source for all API stuff.
Adding to the info given by @jdsilva and @NolanHerring this is probably a good start too:
https://create.meraki.io/build/meraki-postman-collection-getting-started/
Great. Thanks for the information