Bulk change street address

SargeZ06
Comes here often

Bulk change street address

I have some networks with as many as 400+ APs and I need to change the address for all of them since they default to Palo Alto. Is there anyway to do this without touching each AP in the dashboard?

 

Thanks

19 Replies 19
PhilipDAth
Kind of a big deal
Kind of a big deal

You would have to write a script.  In the portal you can go "Help/API Docs".

 

Here is the section from the manual with the request to update a devices address.

 

HTTP REQUEST

PUT /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>' -X PUT -H 'Content-Type: application/json' --data-binary '{"name":"Your AP", "lat":37.4180951010362, "lng":-122.098531723022, "serial":"Q2XX-XXXX-XXXX", "mac":"00:11:22:33:44:55:66", "tags":" recently-added "}' 'https://api.meraki.com/api/v0/networks/[networkId]/devices/[serial]'

SAMPLE RESPONSE

Successful HTTP Status: 200

{
  "name":"Your AP",
  "tags":" recently-added ",
  "lat":37.4180951010362,
  "lng":-122.098531723022,
  "serial":"Q2XX-XXXX-XXXX",
  "mac":"00:11:22:33:44:55:66",
  "model":"MR34",
  "address":"1600 Pennsylvania Ave",
  "moveMapMarker": true,
  "lanIp":"1.2.3.4"
}
Adam
Kind of a big deal

Related question to this, is there an easy way to get a list of or to see all devices that don't have a location set?

Adam R MS | CISSP, CISM, VCP, MCITP, CCNP, ITILv3, CMNO
If this was helpful click the Kudo button below
If my reply solved your issue, please mark it as a solution.
PhilipDAth
Kind of a big deal
Kind of a big deal

Go:

Organisation/Overview

 

Look at everything on the map that is no where near you.

Adam
Kind of a big deal

I've tried that and it just shows this. meraki.PNG

Adam R MS | CISSP, CISM, VCP, MCITP, CCNP, ITILv3, CMNO
If this was helpful click the Kudo button below
If my reply solved your issue, please mark it as a solution.
PhilipDAth
Kind of a big deal
Kind of a big deal

If you click on the icon of the "House" near the top left?

 

If the zoom doesn't change greatly then that implies everything has an address.

Adam
Kind of a big deal

The house button just takes me to the full map overview.  The zoomed in portion is a cluster of devices showing California (presumably Meraki HQ) as the location.  But if I click on the icon or use any other method I cannot view which devices don't have an address. 

Adam R MS | CISSP, CISM, VCP, MCITP, CCNP, ITILv3, CMNO
If this was helpful click the Kudo button below
If my reply solved your issue, please mark it as a solution.
PhilipDAth
Kind of a big deal
Kind of a big deal

Crap.  Your correct.  In that case, I'm not how to identify individual devices easily that don't have an address configured.

EricGlodowski
Here to help

I'm in the same boat.  Trying to update the address of numerous devices with one API call.  What I can't seem to figure out is how to tell the API call to update the address for multiple serial numbers.

 

https://dashboard.meraki.com/api/v0/networks/{{networkId}}/devices/{{serial}}

 

I understand how to edit my environment so {{serial}} would be updated with the actual serial number, but I don't want to do this for each serial number.  I also understand that I could change the URL with the actual serial number of each device, but I'm still stuck doing an API call per serial number.

 

 

Netwow
Building a reputation

So is the solution individual apis per serial #?

Adam
Kind of a big deal

@Netwow @RyanB had a script that worked nicely to accomplish this. 

Adam R MS | CISSP, CISM, VCP, MCITP, CCNP, ITILv3, CMNO
If this was helpful click the Kudo button below
If my reply solved your issue, please mark it as a solution.
RyanB
Meraki Employee
Meraki Employee

PM'd you! with the script. 

Adam
Kind of a big deal


@RyanB wrote:

PM'd you! with the script. 


Maybe worth shooting it to @EricGlodowski above as well.  If I recall correctly Ryan's script just loops through the devices so it makes it pretty easy. 

Adam R MS | CISSP, CISM, VCP, MCITP, CCNP, ITILv3, CMNO
If this was helpful click the Kudo button below
If my reply solved your issue, please mark it as a solution.
SargeZ06
Comes here often

Can I get the script too?

 

thanks

 

SargeZ06
Comes here often

So I was able to pull down all the devices without an address with the script but how would I change the address on a batch of devices with say the same tag?

RyanB
Meraki Employee
Meraki Employee

Hey Sarge,

 

That would require customizing the script to be checking devices for their tags, and then batched on a match running an update call to send back the address for the device.

 

Depending how many you have to do I'd check out this tool: https://create.meraki.io/build/dashboard-api-react-toolbox-demo/

 

There is even a live demo which you could use if you don't want to download and deploy the docker package. 

https://meraki-api-react-toolbox.herokuapp.com/

 

This would let you put in your API key, and in one swoop update the addresses for every single device in a particular network to the same thing. So my script likely provided you with all the networks where there are devices missing addresses, and you could use this to bulk import addresses.

 

Let me know if this helps! 

 

SargeZ06
Comes here often

That's pretty awesome. Seems to stop working at 5 devices though.

 

 

SargeZ06
Comes here often

So I installed Docker and hyper-v on my PC and ran the toolbox locally and it changed 9 out of 76 this time. Then seemed to hang.

 

 

SargeZ06
Comes here often

Just saw this:

 

Current behavior notes

  • The toolbox doesn't respect dashboard's 5 calls per second limit. If any update requests fail, they are scheduled to retry 2-8 seconds later. If the request fails 6 times then it dies. Failures are not currently logged.

 

Damnit it showed promise.

 

PhilipDAth
Kind of a big deal
Kind of a big deal

Try adding a 200ms delay to the code after each address change.
Get notified when there are additional replies to this discussion.