QuestionQ3

Controller-Based Network Automation

An engineer must list every network for a specific Meraki organization. The engineer must call the organization’s network endpoint and save the returned JSON inventory to disk. Drag the code snippets from the bottom into the boxes in the code to construct the artifact. Not all options are 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"
}

resp = requests.(
    f"{base}//{org_id}/",
    headers=headers,
    timeout=30
)
resp.raise_for_status()

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

The Meraki Dashboard API network-inventory operation is GET /organizations/{organizationId}/networks. A GET request retrieves the collection without changing it, and the response can be serialized with json.dump. The supplied x-cisco-meraki-api-key token is the API-key header option for this artifact; tenants, projects, and X-Auth-Token do not form the required Meraki organization-networks request.

Learn more

Community Discussion

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