It's simple but works:
Script Reference:
import requests
import datetime
now = datetime.datetime.now()
filename_prefix ='log'
network = "NETWORK-ID"
s1 = "AP-SERIAL_NUMBER"
#RUNNING REBOOT ON DEVICES
ap1 = "https://api.meraki.com/api/v0/networks/{}/devices/{}/reboot".format(network, s1)
payload = {}
headers = {
'X-Cisco-Meraki-API-Key': 'API_KEY,
'Content-Type': 'application/json'
}
#GENERATING THE RESPONSE CODE (TRUE = REBOOT OK /FALSE = REBOOT NOT OK)
response1 = requests.request("POST", ap1, headers=headers, data = payload)
)
#CREATING THE LOG FILE
filename = "%s_%.2i-%.2i-%i_%.2i-%.2i.txt" % (filename_prefix,now.day,now.month,now.year,now.hour,now.minute)
f = open(filename, 'w')
print('AP01', response1.text.encode('utf8'), file=f)f)
f.close()
I am not a Cisco Meraki employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.
Please, if this post was useful, leave your kudos and mark it as solved.