Automation & Programmability // Lesson 05

REST-Based APIs.

Recognise REST resources, URIs, authentication, CRUD operations, HTTP verbs, status codes and data encoding.

RESTCRUDHTTP verbsStatus codesAuthentication
01 // Mental model

Start with the big picture.

A thing represented by a URI, such as a device, interface, site or policy.

CCNA focus: Read the method, URI, authentication header, content type, status code and body together. Never put long-lived secrets directly into source code or logs.
02 // Building blocks

Know what each part does.

01

Resource

A thing represented by a URI, such as a device, interface, site or policy.

02

HTTP method

GET reads, POST commonly creates, PUT replaces, PATCH partially updates and DELETE removes.

03

Representation

JSON is common for request and response bodies; headers describe content type and authentication.

04

Stateless request

Each request carries the context needed for the server to process it; sessions or tokens may still represent identity.

03 // Compare and recognise

Read the clues.

ItemWhat to remember
200 / 201Successful request / resource created.
204Successful request with no response body.
400 / 401 / 403Bad request / unauthenticated / authenticated but forbidden.
404 / 500Resource not found / server-side failure.
04 // HTTP exchange

HTTP exchange.

GET /api/v1/devices/edge-1 HTTP/1.1
Host: controller.example
Authorization: Bearer <token>
Accept: application/json

HTTP/1.1 200 OK
Content-Type: application/json

{"id":"edge-1","status":"reachable"}

Read the example from top to bottom, then verify the resulting state. Configuration is only complete when the output matches the intended design.

05 // Exam and troubleshooting

Turn facts into a method.

  • Successful request / resource created.
  • Successful request with no response body.
  • Bad request / unauthenticated / authenticated but forbidden.
  • Resource not found / server-side failure.
Exam checkpoint: Read the method, URI, authentication header, content type, status code and body together. Never put long-lived secrets directly into source code or logs.
06 // Check yourself

REST-Based APIs quiz.

1. Which HTTP verb retrieves a resource?

2. Which CRUD action corresponds to DELETE?

3. What does HTTP 201 normally indicate?

4. What is the usual distinction between 401 and 403?

5. Which encoding is common in REST API bodies?

Score: 0 / 5