Watch first
JSON, XML & YAML (Day 60)
Video credit: Jeremy's IT Lab
Watch on YouTubeREST APIs (Day 61)
Video credit: Jeremy's IT Lab
Watch on YouTubeAlso watch — playlist supplement
JSON (ENCOR 6.2) — CCNA automation context
Video credit: David Bombal
Watch on YouTubeREST APIs Part 1 (ENCOR 6.4)
Video credit: David Bombal
Watch on YouTubePlain-English explanation
REST APIs expose network functions over HTTP/HTTPS using URLs (endpoints) and standard verbs. JSON is the most common data format — human-readable key/value pairs and arrays that scripts and controllers exchange.
Instead of show ip interface brief, an automation app might GET /interfaces and receive JSON listing each interface state — same data, machine-friendly.
Deep dive
HTTP verbs (CRUD mapping):
| Verb | Typical use | |------|-------------| | GET | Read data — safe, no change | | POST | Create resource | | PUT | Replace entire resource | | PATCH | Partial update | | DELETE | Remove resource |
JSON example:
{
"hostname": "R1",
"interfaces": [
{ "name": "Gi0/0", "ip": "10.1.1.1", "status": "up" },
{ "name": "Gi0/1", "ip": "10.2.1.1", "status": "down" }
]
}
XML/YAML (awareness): NETCONF often XML; Ansible playbooks YAML. CCNA expects JSON literacy first.
Auth: API tokens, OAuth, basic auth over HTTPS — never cleartext credentials on wire.
Step-by-step — read API response
Given JSON above:
- How many interfaces? → 2 (array length)
- Which is down? → Gi0/1
- Hostname? → R1
Practice in the automation sandbox tool — match keys to questions quickly.
POST example (conceptual): Create VLAN 30 via API body {"vlan-id": 30, "name": "GUEST"} — exact endpoint varies by platform.
Commands to know
curl -k -H "Accept: application/json"
-H "Authorization: Bearer TOKEN"
https://203.0.113.1/restconf/data/ietf-interfaces:interfaces
show ip interface brief
Troubleshooting
| API issue | Check | |-----------|-------| | 401 Unauthorized | Token expired, wrong credentials | | 404 Not Found | Wrong endpoint path or API version | | 400 Bad Request | Malformed JSON body | | 415 Unsupported | Missing Content-Type: application/json |
Read response status code first — 2xx success, 4xx client error, 5xx server error.
Exam relevance
GET retrieves without modifying. Using GET to "change" config is wrong — use POST/PUT/PATCH per operation.
Double quotes on keys/strings, commas between pairs, arrays in [ ], objects in { } — trailing comma invalid in strict JSON.
Practice checklist
- Parse three sample JSON API responses without tools
- Match HTTP verbs to create/read/update/delete scenarios
- Use automation sandbox for REST scenario drills
- Convert one CLI show output conceptually to JSON fields
- Explain HTTPS importance for API credentials
Which HTTP method should retrieve device facts without changing configuration?
In JSON, which bracket type holds key-value pairs?