API reading of templates and Radio Settings

Solved
cta102
Building a reputation

API reading of templates and Radio Settings

I have don'e no serious API coding and have had an issue landed on my lap and want to ask if some API effort will yield a decent reward.

After a fairly reasonable Meraki install (1700+ sites) it has been found that some troublesome sites had individual Radio Profiles added, which differ from the official templates and nobody thought of keeping a list.

The customer want's these nonstandard profiles removed and I was wondering if the Profiles are easily read via the API so I can track these down (and change them manually.)

Normally I would simply try coding something myself, but a ridiculously short time has been allowed for finding these and on top of that I can't run API scripts from work.

So if somebody can state whether it's trivial or awkward task it would be appreciated (I do have a programming background but I haven't done any Meraki API stuff apart from grabbing AP names)

I'm not looking for somebody to hand me a script to do this  I simply need to to know which is  the is viable option of my two choices

1: Wait until I get home and write something to do the query

2: Start searching manually (in work) this afternoon and probably be finished by the end of tomorrows work day (and very ill tempered.)

Info appreciated

1 Accepted Solution
HodyCrouch
Building a reputation

This shouldn't be too difficult using the Dashboard API.

 

Start with a call to get the inventory.  This will include the serial and networkId for all devices.

 

You will then have to loop through all of the devices and call 

 

/networks/{networkId}/devices/{serial}/wireless/radioSettings

 

Each call will return the device serial and rfProfileId.

 

You will be working against the API rate limit, so make sure your script is throttled and that you include some retry logic.

 

You should be able to get through a few thousand access points in less than 5 minutes.

View solution in original post

3 Replies 3
HodyCrouch
Building a reputation

This shouldn't be too difficult using the Dashboard API.

 

Start with a call to get the inventory.  This will include the serial and networkId for all devices.

 

You will then have to loop through all of the devices and call 

 

/networks/{networkId}/devices/{serial}/wireless/radioSettings

 

Each call will return the device serial and rfProfileId.

 

You will be working against the API rate limit, so make sure your script is throttled and that you include some retry logic.

 

You should be able to get through a few thousand access points in less than 5 minutes.

cta102
Building a reputation

Thanks,

 

I will have a bicker with it tonight to see if I can get something running as I only need a list of offending sites anyway.

 

Much appreciated

cta102
Building a reputation

Addendum:

 

I only got time to return to this yesterday afternoon and I also have no experience whatsoever of Python.

 

Sadly meraki.py appears to be somewhat abandoned and the /wireless/radioSettings method has been added since it's last update, therefore it's annoying to use.

Anyway I have added getdevicenetdetail to meraki.py and it's called like this and it returns the serial number and rfProfileId values for the AP


radiodetail = meraki.getdevicenetdetail(my_key, my_net_id, target_ser)
print(radiodetail)

 

Add the following into your meraki.py

----- start -----

 

# Returns the serial number and rdProfileId for the specified AP
# Make sure it is an AP that you query otherwise it will error

def getdevicenetdetail(apikey, networkid, serialnumber, suppressprint=False):
calltype = 'Device Detail'
geturl = '{0}/networks/{1}/devices/{2}/wireless/radioSettings'.format(
str(base_url), str(networkid), str(serialnumber))
headers = {
'x-cisco-meraki-api-key': format(str(apikey)),
'Content-Type': 'application/json'
}

dashboard = requests.get(geturl, headers=headers)
#
# Call return handler function to parse Dashboard response
#
result = __returnhandler(
dashboard.status_code, dashboard.text, calltype, suppressprint)
return result

 

----- end -----

 

 

 

Get notified when there are additional replies to this discussion.