This is not working for me. Why not? (& thank you).
Here is the API call:
/devices/{serial}/wireless/latencyStats
Get Device Wireless Latency Stats - Meraki Dashboard API v1 - Cisco Meraki Developer Hub
Error occurred during API call: 400 Client Error: Bad Request for url (Real SN is used): https://api.meraki.com/api/v1/devices/AAAA-BBBC-DDDD/wireless/latencyStats
Here's my full code:
import requests
BASE_URL = 'https://api.meraki.com/api/v1/'
def get_api_key():
return input("Enter your Meraki API key: ")
def get_latency_stats(api_key, serial):
headers = {
'X-Cisco-Meraki-API-Key': api_key,
}
try:
response = requests.get(BASE_URL + f'devices/{serial}/wireless/latencyStats', headers=headers)
response.raise_for_status() # Raise an exception for unsuccessful API calls
return response.json()
except requests.exceptions.RequestException as e:
print(f"Error occurred during API call: {e}")
return {}
def main():
api_key = get_api_key()
serial = input("Enter the serial number of the device you want latency stats for: ")
latency_stats = get_latency_stats(api_key, serial)
if latency_stats:
print("Latency Stats:")
print(latency_stats)
if __name__ == "__main__":
main()