cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bulk changes to multiple network devices

Highlighted
Comes here often

Bulk changes to multiple network devices

I see there is a JSON script for updating the attributes for devices but it only allows for one at a time. Does anything exist for updating tags or any attribute with one api call?

 

It also seems as though to update one attribute , it requires all attributes to be included in the script. Can someone please advise?

6 REPLIES 6
Highlighted
Kind of a big deal

Re: Bulk changes to multiple network devices

You might need to give a specific example.

 

Here is an example of one API call and it lets you update lots of things at once.

https://dashboard.meraki.com/api_docs/v0#update-the-attributes-of-a-device 

 

Does it really make that much difference making muliple API calls?

Highlighted
Comes here often

Re: Bulk changes to multiple network devices

Yes i have already explored that API call. What i am looking to do is to update lets say at least 10-25 devices (switches or APs) at once in the same network with new tags and or new address. This particular API call appears to only let you do one serial number at a time and requires all the attributes be completed.

 

Does that give a clearer picture?

 

It makes a difference because from what i am understanding i would have to change out the serial # for each call when i would like to just do one push and it pushes the "new tag" and/or "new address" to all the devices.

Highlighted
Comes here often

Re: Bulk changes to multiple network devices

Yes i have already explored that API call. What i am looking to do is to update lets say at least 10-25 devices (switches or APs) at once in the same network with new tags and or new address. This particular API call appears to only let you do one serial number at a time and requires all the attributes be completed.



Does that give a clearer picture?



It makes a difference because from what i am understanding i would have to change out the serial # for each call when i would like to just do one push and it pushes the "new tag" and/or "new address" to all the devices.
Highlighted
Conversationalist

Re: Bulk changes to multiple network devices

I'm pretty new to the API myself so this may not be a comprehensive answer.  I'm doing something similar, renaming APs and so far I have been able to change 15 at once using that API call and Collection Runner in Postman.

 

Here's what I did:

*Install Postman and the Meraki Dashboard API Collection (the collection is optional, you can just type this in)

*Create a new request in Postman (either make environment variables for your API key, the baseURL, and networkId or just fill them in).  Here is what mine looks like.


          {{baseUrl}}/networks/{{networkId}}/devices/{{serial}}?name={{name}}

 

*Create a .csv file with two columns.  One has header "serial" and the other has header "name"

*Click Runner in Postman to open that window.  Choose the request you created above and use Select File to choose the .csv file

*Click Run Start

*Check the Meraki dashboard to see that it worked.

 

My command only updates the name, so any variables you don't change stay the same.  You should be able to change the name variable to be your tag variable instead and add another one for the address.

Here's a link to the Postman variable documentation that may help with adding another variable.  https://learning.postman.com/docs/postman/variables-and-environments/variables/

 

Hope that helps.

Comes here often

Re: Bulk changes to multiple network devices

thanks unfortunately i am getting 404 error codes dont understand why.

i just first with your serial number but that doesn't work and neither with the tag inserted as a variable as well.

https://{{shard}}.meraki.com/api/v0/newtorks/{{network_Id}}/devices/Q2KD-XXXX-XXXX?name=AP001
Highlighted
Here to help

Re: Bulk changes to multiple network devices

Hi

 

Using Postman is one way of doing it, however If you use Python and the Meraki API call, you can browse through that network, obtain all serials of the devices and the change the objects you want.... Done that several times already with my networks here.

 

here is an example of the things we use here. (identing is gone with cut and paste)

 

 

def Add_Network_Device(def_network,def_serial,def_site_code):

  #
  # First check if device is already in network
  #

  device_there = 0
  my_network_devices = dashboard.devices.getNetworkDevices(def_network)

  for my_network_device in my_network_devices:

if def_serial == my_network_device['serial']:
print ("device ",my_network_device["model"],"with serial",def_serial,"already added")
device_there = 1

if device_there == 0:

print ('Adding ',def_serial,' to netowrk id : ',def_network)

try:
response = dashboard.devices.claimNetworkDevices(def_network,serial=def_serial )
print (response)

except:
print ("Failed to add device")
quit()

my_device = dashboard.devices.getNetworkDevice(def_network,def_serial)

model_type = str(my_device['model'])

if model_type[:2] == "MX":
def_site_code += "-FW1"
elif model_type[:2] == "MS":
def_site_code += "-SW01"
elif model_type[:2] == "MR":
def_site_code += "-AP01"

param = {}

param['name'] = def_site_code

try:
response = dashboard.devices.updateNetworkDevice(def_network,def_serial,**param)
print (respons)
except:
print ("Cannot update ")

print ("Name is : ",def_site_code)

 

Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.