Week 12 · Lesson 5

REST APIs and HTTP CRUD

Almost every modern network controller and cloud service exposes a REST API. REST is not a protocol — it is a set of conventions on top of HTTP. Learn how a URI names a resource, how an HTTP method asks for an action, and how a status code tells you what happened.

CCNA 200-301 Domain 6.0 Automation and Programmability Verified 2026-10-11
Part 1

What is REST?

REST stands for REpresentational State Transfer. It is an architectural style — a set of constraints — for building web services, described by Roy Fielding in 2000. An API that follows those constraints is called a RESTful API. In practice a REST API is ordinary HTTP with a consistent, resource-oriented shape, exchanging data usually in JSON.

Definition — REST. An architectural style for web services in which clients manipulate named resources using standard HTTP methods and a uniform interface, with each request carrying all the information needed to understand it.

The single most important REST constraint for the exam is that REST is stateless:

Definition — stateless. Each request from the client contains all the information the server needs to process it. The server does not store client context between requests; every request stands alone.

Because the server keeps no session, it cannot “remember” who you are from the last request — so every request must carry its credentials (for example, a token in a header). This is what makes REST APIs easy to scale: any server in a pool can handle any request, because no request depends on a previous one.

Everything you do in this lesson has a direct counterpart in the controller world you met in Lesson 4: the northbound API of Catalyst Center is a REST API, and the objects it exchanges are JSON documents. The next lesson deals with the format itself.

Part 2

URIs name resources

A REST API is organised around resources — the things you want to read or change: interfaces, VLANs, devices, users. Each resource is named by a URI (Uniform Resource Identifier), and the same URI is used with different HTTP methods to do different things.

Anatomy of a URI · select a part
https sandbox.example.com /api/v1/devices ?limit=50 scheme host path query string https://sandbox.example.com/api/v1/devices?limit=50 the resource is /devices — a noun. The action comes from the HTTP method.

PartMeaningExample
SchemeProtocol (HTTPS = HTTP over TLS)https
HostServer or controller namesandbox.example.com
PathThe resource being addressed/api/v1/devices
Query stringOptional filters/parameters?limit=50
Note. REST URIs use nouns, not verbs. The resource is /devices; the action comes from the HTTP method. Writing /getDevices is a common beginner mistake — the verb belongs in the method, not the URI.

A path such as /api/v1/devices/42/interfaces reads naturally: version 1 of the API, the device with ID 42, and its interfaces. Versioning (v1) lets the provider change the API later without breaking existing clients.

Part 3

HTTP methods and CRUD

REST maps HTTP methods onto the four basic data operations, known by the acronym CRUD — Create, Read, Update, Delete. Memorising this mapping is essential.

HTTP methodCRUD operationMeaningExample on /devices/42
GETReadRetrieve a resource (or list)Get device 42’s details
POSTCreateCreate a new resourceAdd a new device
PUTUpdate (replace)Replace the whole resourceOverwrite device 42 entirely
PATCHUpdate (partial)Change only the fields sentChange only device 42’s name
DELETEDeleteRemove the resourceRemove device 42
Definition — CRUD. Create, Read, Update, Delete — the four fundamental operations on data, mapped to POST, GET, PUT/PATCH, and DELETE in HTTP.

The one nuance worth knowing is the difference between PUT and PATCH. PUT is a full replacement: you send the complete resource as it should now be, and fields you omit may be dropped. PATCH is a partial update: you send only the fields that change, and everything else stays as it was.

Exam tip. Learn the mapping cold: GET = read, POST = create, PUT = replace, PATCH = partial update, DELETE = delete. A frequent trap is confusing PUT (whole resource) with PATCH (just the changed fields). If the question says “only one field changes”, the answer is PATCH.
Pick the operation you need · see the method

      

Part 4

Status codes

Every HTTP response carries a three-digit status code in its first line. The first digit groups the outcome: 2xx success, 3xx redirection, 4xx client error, 5xx server error. You should know these six.

CodeNameMeaning
200OKRequest succeeded; the response contains the data (typical GET).
201CreatedA new resource was created (typical POST).
400Bad RequestThe client sent malformed or invalid data.
401UnauthorizedAuthentication is missing or invalid (not logged in / bad token).
404Not FoundThe resource in the URI does not exist.
500Internal Server ErrorThe server failed while handling a valid request.
Definition — status classes. 2xx = success, 3xx = redirected, 4xx = the client did something wrong, 5xx = the server did something wrong.

Distinguishing 400 from 401 and 404 from 500 is the usual test. 400 means the request itself was bad (bad JSON, bad parameter); 401 means it could not be authenticated; 404 means it was well-formed but pointed at nothing; and 500 means the server broke, through no fault of the request.

Status code explorer · select a code

Part 5

Headers, body, and authentication

An HTTP request has four parts: the method, the URI, optional headers, and an optional body. Headers are key/value pairs carrying metadata; the body carries the actual data (for example, the JSON describing a device to create).

HeaderPurpose
Content-TypeTells the server what format the body is in (for example, application/json).
AcceptTells the server what format the client wants back.
AuthorizationCarries credentials, such as a token.

Because REST is stateless, every request authenticates itself. Two common mechanisms:

Definition — API token. A short credential issued after authentication that the client presents on subsequent requests in place of a username and password. Often time-limited and revocable.
Token authentication flow · step through it
Step 1 of 4

      

Part 6

Encoding and security

Two ideas complete the picture. First, URL encoding: some characters are not allowed in a URI (spaces, &, ?, non-ASCII), so they are percent-encoded. A space becomes %20, and & in data becomes %26. This keeps the URI unambiguous.

Second, transport security. REST is a set of conventions, not a security mechanism. The security comes from running it over HTTPS, which wraps HTTP inside TLS and encrypts the whole exchange, including the credentials or token in the headers. Sending a token or password over plain HTTP is equivalent to shouting it across the room.

Exam tip. Remember that Base64 is encoding, not encryption. A question that says credentials are “encrypted with Base64” is wrong — they are merely encoded, which is exactly why Basic auth requires HTTPS. The exam likes this distinction.
Part 7 · Your turn

Review

Check what you have learned with these review questions.

Review · 6 questions

Key termMeaning
RESTREpresentational State Transfer; an architectural style for resource-oriented web APIs over HTTP.
StatelessEach request carries all needed information; the server stores no client context.
URIUniform Resource Identifier; names a resource (for example, /api/v1/devices).
CRUDCreate, Read, Update, Delete; the operations mapped to HTTP methods.
GET/POST/PUT/PATCH/DELETEHTTP methods for read/create/replace/partial-update/delete.
Status codeThree-digit response code: 2xx success, 4xx client error, 5xx server error.
HeaderKey/value metadata in a request or response (Content-Type, Accept, Authorization).
Bearer tokenA credential issued after login, sent in the Authorization header.
Base64An encoding (not encryption) used to carry credentials or binary data as text.
Sources & references
  1. Cisco. CCNA (200-301) Exam Topics, Domain 6.0 Automation and Programmability. cisco.com.
  2. Fielding, R. Architectural Styles and the Design of Network-based Software Architectures (2000), Chapter 5. ics.uci.edu.
  3. Fielding, R. & Reschke, J. RFC 7231: HTTP/1.1 Semantics and Content (2014). rfc-editor.org/rfc/rfc7231.
  4. Rescorla, E. RFC 2818: HTTP Over TLS (2000). rfc-editor.org/rfc/rfc2818.

Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.