CCNA: REST APIs & JSON with a Network Controller
Your branch network is managed by an SDN controller with a northbound REST API at `http://127.0.0.1:8181`. Authenticate, pull the inventory as JSON, script a health report, then push a change through the API instead of the CLI.
Tasks
- Request an API token: POST /api/v1/token with HTTP basic auth admin / Cisco123, and save just the token value to ~/token.txt.
- List every device (GET /api/v1/devices, send the token in the X-Auth-Token header) and save the JSON response to ~/devices.json.
- Write ~/down.py that calls the API (with requests or urllib) and prints the hostname of each device whose status is down, one per line.
- Device 3 is down: set its description to WAN down - ticket 4521 and its vlan to 99 with an authenticated PATCH /api/v1/devices/3.