A structured lesson workspace with readable content, hands-on examples, and a clean path to completion.
curl -X GET https://sandboxdnac.cisco.com/dna/system/api/v1/auth/token -H "Authorization: Basic $(echo -n 'devnetuser:Cisco123!' | base64)" -k
That single command authenticates to Cisco's public DNA Center sandbox and requests an API token. Real production controllers work the same way — you authenticate, get a token, and use that token for subsequent requests. Every modern controller and many network devices expose a REST API.
| Method | Purpose | Example |
|---|---|---|
| GET | Retrieve a resource | Get device list |
| POST | Create a new resource | Create a new VLAN |
| PUT | Replace an existing resource | Update full device config |
| PATCH | Modify part of a resource | Change device description |
| DELETE | Remove a resource | Delete a VLAN |
PUT and PATCH are subtle. PUT replaces the entire resource — if you PUT a partial object, you may wipe out fields you didn't include. PATCH modifies only what you send. For network automation, always prefer PATCH when available — a PUT with a partial object can silently erase configuration.
The base64-encoded string after `Basic` is `devnetuser:Cisco123!`. That's the username:password in base64 — HTTP Basic authentication. The controller verifies the credentials and returns a JSON Web Token (JWT). The token goes in the `Authorization: Bearer <token>` header of subsequent requests.
# Using the token to get a list of devicescurl -X GET https://sandboxdnac.cisco.com/dna/intent/api/v1/network-device \-H "X-Auth-Token: $TOKEN" \-H "Content-Type: application/json" \-k | jq '.response[0]'# Expected output (abbreviated):# {# "id": "a1b2c3d4-...",# "hostname": "sw1.example.com",# "managementIpAddress": "10.10.20.10",# "platformId": "C9300-48P",# "softwareVersion": "17.9.4a",# ...# }
That's a GET request with the token in the `X-Auth-Token` header (DNA Center's convention — some APIs use `Authorization: Bearer`). The response is JSON — parsed here with `jq` for readability. In Python, you'd use the `requests` library instead of curl.
Authenticate to the DNA Center sandbox (sandboxdnac.cisco.com, user devnetuser, password Cisco123!). Retrieve the token. Then call the network-device endpoint and list the first three devices. Verify your token is being accepted by checking the HTTP status code (should be 200).
REST APIs are how you programmatically interact with controllers and modern devices. Authenticate, get a token, make requests with the token. Learn the HTTP methods and their semantics. Section 18 continues with JSON and hands-on Python automation.
Finish the lesson once you have worked through the material. This awards ★ 15 XP.