API for setting address location

Sahar
New here

API for setting address location

Hello,

 

I have many network under one organization .

Under each network i need to address it by hes location, and that's a lot of devices..

can i do it by some API?

 

i already downloaded "meraki-api-toolbox" but it isn't working that good..

 

ty

2 REPLIES 2
BrechtSchamp
Kind of a big deal

Sure you can.

 

First get all networks in your organisation:

GET List the networks in an organization

{{baseUrl}}/organizations/{{organizationId}}/networks

 

Loop over them and get the devices in each network:

GET List the devices in a network

{{baseUrl}}/networks/{{networkId}}/devices

Then loop over the devices and set their locations:

PUT Update the attributes of a device
{{baseUrl}}/networks/{{networkId}}/devices/{{serial}}

 

Parameters for that update call:

 

parameters Description of the parameter
nameThe name of a device
tagsThe tags of a device
latThe latitude of a device
lngThe longitude of a device
addressThe address of a device
moveMapMarkerWhether 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.

 

Put pauzes in your script so you don't go over the rate limit for the calls:

Note: Call volume is limited to 5 calls per second (per organization)

I have one minor alternative to @BrechtSchamp 's method. For my Orgs it simply takes too long to iterate through every Org, and then every network to get the device list. I use this call to return all the devices in an Org in a single call:

 

https://api.meraki.com/api_docs#return-the-inventory-for-an-organization

 

{{baseUrl}}/organizations/{{id}}/inventory

 

And then do what I need to do on each device. It's much quicker than getting every network in an Org first (if you have lots and lots of networks in an Org, like we do).

 

 

Get notified when there are additional replies to this discussion.