cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a API?

SOLVED
Comes here often

How to create a API?

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

List the devices in a network
HTTP RequestGET/networks/[networkId]/devices Parameters
    None
Sample Request
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'
Sample Response

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
    }
  }
]
Return a single device
HTTP RequestGET/networks/[networkId]/devices/[serial] Parameters
    None
Sample Request
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]'
Sample Response

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
  }
}
Return the uplink information for a device.
HTTP RequestGET/networks/[networkId]/devices/[serial]/uplink Parameters
    None
Sample Request
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'
Sample Response

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
  }
]
Update the attributes of a device
HTTP RequestPUT/networks/[networkId]/devices/[serial] Parameters
  • name
    The name of a device
  • tags
    The tags of a device
  • lat
    The latitude of a device
  • lng
    The longitude of a device
  • address
    The address of a device
  • moveMapMarker
    Whether or not to set the latitude and longitude of a device based on the new address. Only applies when lat and lng are not specified.
Sample Request
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]'
Sample Response

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
  }
}
Claim a device into a network
HTTP RequestPOST/networks/[networkId]/devices/claim Parameters
  • serial
    The serial of a device
Sample Request
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'
Sample Response

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
  }
}
Remove a single device
HTTP RequestPOST/networks/[networkId]/devices/[serial]/remove Parameters
    None
Sample Request
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'
Sample Response

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
  }
}
List LLDP and CDP information for a device
HTTP RequestGET/networks/[networkId]/devices/[serial]/lldp_cdp Parameters
  • timespan
    The timespan for which LLDP and CDP information will be fetched. Must be in seconds and less than or equal to a month (2592000 seconds). LLDP and CDP information is sent to the Meraki dashboard every 10 minutes. In instances where this LLDP and CDP information matches an existing entry in the Meraki dashboard, the data is updated once every two hours. Meraki recommends querying LLDP and CDP information at an interval slightly greater than two hours, to ensure that unchanged CDP / LLDP information can be queried consistently.
Sample Request
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'
Sample Response

Successful HTTP Status: 200

1 ACCEPTED SOLUTION

Accepted Solutions
Head in the Cloud

Re: How to create a API?

Shameless self plug, but this should help get you going. ^_^

https://nolanwifi.com/2018/10/28/meraki-api-where-do-you-start/

As for using a scripting program like Python to tie into it and all that jazz, I can't help with that just yet.

Nolan Herring | nolanwifi.com
TwitterLinkedIn
4 REPLIES
Kind of a big deal

Re: How to create a API?

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. 

 

https://documenter.getpostman.com/view/897512/meraki-dashboard-api/2To9xm#e411649f-8ae2-47e0-af61-57...

 

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).

Head in the Cloud

Re: How to create a API?

Shameless self plug, but this should help get you going. ^_^

https://nolanwifi.com/2018/10/28/meraki-api-where-do-you-start/

As for using a scripting program like Python to tie into it and all that jazz, I can't help with that just yet.

Nolan Herring | nolanwifi.com
TwitterLinkedIn
Highlighted
Building a reputation

Re: How to create a API?

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/

Comes here often

Re: How to create a API?

Great. Thanks for the information