6.4 REST-Based APIs

Key Takeaways

  • REST APIs use HTTP methods (GET, POST, PUT, PATCH, DELETE) to interact with controllers and devices.
  • CRUD maps to HTTP: Create=POST, Read=GET, Update=PUT/PATCH, Delete=DELETE.
  • HTTP status codes signal results: 2xx success, 3xx redirect, 4xx client error, 5xx server error.
  • REST is stateless — every request carries all needed data, including its auth token; the server keeps no session.
  • REST responses are typically JSON, exchanged over HTTPS, secured with token-based auth or OAuth 2.0.
Last updated: June 2026

What a REST API Is

REST (Representational State Transfer) is an architectural style for web APIs (Application Programming Interfaces). A RESTful API lets software talk to a controller or device over HTTP/HTTPS instead of a human typing CLI commands. You send an HTTP request to a URL endpoint and get back structured data — almost always JSON.

Example — list devices from Cisco Catalyst Center:

GET https://catalystcenter.example.com/dna/intent/api/v1/network-device
Authorization: Bearer <token>
Content-Type: application/json

Response (JSON):

{
  "response": [
    {
      "hostname": "SW-Floor1",
      "managementIpAddress": "10.0.0.10",
      "platformId": "C9300-48T",
      "softwareVersion": "17.9.1",
      "reachabilityStatus": "Reachable"
    }
  ]
}

The Six REST Constraints

ConstraintMeaning
Client-ServerClient requests, server responds; the two evolve independently
StatelessEach request is self-contained; the server stores no session between calls
CacheableResponses can be marked cacheable to cut repeat traffic
Uniform interfaceStandard HTTP verbs and predictable URL structure
Layered systemClient cannot tell if it is talking to the server or a proxy/gateway
Code on demand (optional)Server may return executable code (rarely used)

The most-tested one is stateless: if a question describes "each request must include all information the server needs, such as the auth token," the answer is stateless.

HTTP Methods and CRUD

Every REST call uses an HTTP verb that maps to a CRUD operation (Create, Read, Update, Delete).

HTTP methodCRUDPurposeNetworking example
GETReadRetrieve data (no change)List all VLANs
POSTCreateMake a new resourceCreate VLAN 10
PUTUpdate (full)Replace the entire resourceReplace a device's whole config
PATCHUpdate (partial)Modify part of a resourceRename one VLAN
DELETEDeleteRemove a resourceDelete VLAN 10

GET is safe (read-only) and idempotent; PUT and DELETE are idempotent (repeating them lands the same final state); POST is not idempotent (repeat it and you may create duplicates).

HTTP Status Codes

The first digit defines the class; memorize the class meanings and the common specific codes.

RangeClassMeaning
1xxInformationalRequest received, still processing
2xxSuccessRequest succeeded
3xxRedirectionFurther action needed
4xxClient errorProblem with the request
5xxServer errorProblem on the server
CodeMeaning
200 OKRequest succeeded
201 CreatedNew resource created (often follows POST)
204 No ContentSucceeded, nothing to return (often follows DELETE)
400 Bad RequestMalformed request syntax
401 UnauthorizedNot authenticated — no/invalid credentials
403 ForbiddenAuthenticated but not permitted
404 Not FoundThe resource does not exist
500 Internal Server ErrorThe server failed to process a valid request

Trap: 401 vs 403 — 401 means you have not proven who you are; 403 means we know who you are, but you are not allowed.

Authentication

MethodHow it works
Basic Authusername:password Base64-encoded in the header (weak)
API keyA unique key in a header or URL parameter
Token-basedLog in once, receive a token, send the token on every later request
OAuth 2.0Industry standard for delegated, scoped authorization

Cisco Catalyst Center, Meraki Dashboard, ACI, and SD-WAN (vManage) all expose REST APIs used exactly this way for automation.

On the Exam: Know the verb-to-CRUD mapping cold, recognize 200/201/401/403/404/500, and remember REST is stateless and returns JSON over HTTPS.

Anatomy of a REST Request and Response

It helps to see every moving part of a single transaction. A REST request has four pieces: the method (the verb such as GET or POST), the URI (the endpoint plus any resource identifiers and query parameters), the headers (metadata such as Authorization: Bearer <token>, Accept: application/json, and Content-Type: application/json), and an optional body (the JSON payload, used on POST, PUT, and PATCH but not on GET or DELETE). The server replies with a status code that tells you the outcome class, response headers, and a response body carrying the requested or created data.

Consider creating a VLAN on a controller. You send POST /api/v1/vlans with the header Authorization: Bearer eyJ... and a JSON body {"id": 10, "name": "SALES"}. If it works, the server returns 201 Created and a body echoing the new resource, often with the URI where it now lives. If your token expired, you get 401 Unauthorized. If the token is valid but your account cannot create VLANs, you get 403 Forbidden. If you posted to a misspelled endpoint, you get 404 Not Found. If your JSON was malformed, you get 400 Bad Request. And if the controller itself crashed mid-request, you get 500 Internal Server Error.

Walking that single example mentally lets you reconstruct most status-code questions on the exam from first principles rather than rote memory.

Why Statelessness Scales

Because REST is stateless, any server in a load-balanced pool can handle any request — there is no session pinned to one server that another would lack. That is why you must include the auth token on every call rather than logging in once and relying on the server to remember you. This property is what lets cloud platforms and SDN controllers serve thousands of automation clients simultaneously, and it is exactly the behavior the exam describes when it says "each request must contain all the information needed to process it."

Test Your Knowledge

Which HTTP method retrieves data from a REST API without modifying anything on the server?

A
B
C
D
Test Your Knowledge

An API call returns HTTP status code 401. What does it indicate?

A
B
C
D
Test Your Knowledge

Which REST characteristic requires that every API request contain all the information the server needs to process it?

A
B
C
D