QuestionQ83

VerifiedOperations

An engineer needs to monitor device health across a Meraki organization. The engineer must obtain device statuses through the organizations devices/statuses endpoint and archive the JSON. Drag the code snippets into the code boxes to create the artifact. Not every option is used.

Drag & Drop
import requests, json

base = "https://api.meraki.com/api/v1"
org_id = "123456"
api_key = "abcd1234"

headers = {"": api_key, "Accept": "application/json"}

r = requests.(
    f"{base}//{org_id}/",
    headers=headers
)
r.raise_for_status()

with open("device_statuses.json", "w") as f:
    json.dump(r.json(), f, indent=2)
Explanation

Cisco Meraki Dashboard API device-status retrieval uses GET /organizations/{organizationId}/devices/statuses. Requests authenticate with the X-Cisco-Meraki-API-Key header (header names are case-insensitive); the supplied lowercase token is therefore valid Python code for that header.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!