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.
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.
The single most important REST constraint for the exam is that REST is stateless:
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.
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.
| Part | Meaning | Example |
|---|---|---|
| Scheme | Protocol (HTTPS = HTTP over TLS) | https |
| Host | Server or controller name | sandbox.example.com |
| Path | The resource being addressed | /api/v1/devices |
| Query string | Optional filters/parameters | ?limit=50 |
/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.
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 method | CRUD operation | Meaning | Example on /devices/42 |
|---|---|---|---|
| GET | Read | Retrieve a resource (or list) | Get device 42’s details |
| POST | Create | Create a new resource | Add a new device |
| PUT | Update (replace) | Replace the whole resource | Overwrite device 42 entirely |
| PATCH | Update (partial) | Change only the fields sent | Change only device 42’s name |
| DELETE | Delete | Remove the resource | Remove device 42 |
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.
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.
| Code | Name | Meaning |
|---|---|---|
| 200 | OK | Request succeeded; the response contains the data (typical GET). |
| 201 | Created | A new resource was created (typical POST). |
| 400 | Bad Request | The client sent malformed or invalid data. |
| 401 | Unauthorized | Authentication is missing or invalid (not logged in / bad token). |
| 404 | Not Found | The resource in the URI does not exist. |
| 500 | Internal Server Error | The server failed while handling a valid request. |
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.
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).
| Header | Purpose |
|---|---|
Content-Type | Tells the server what format the body is in (for example, application/json). |
Accept | Tells the server what format the client wants back. |
Authorization | Carries credentials, such as a token. |
Because REST is stateless, every request authenticates itself. Two common mechanisms:
- HTTP Basic authentication — the client sends the username and password, Base64-encoded, in the
Authorization: Basic <base64>header. Base64 is encoding, not encryption, so Basic auth must be used only over HTTPS. - Token authentication — the client first authenticates once, receives a time-limited token, and then sends
Authorization: Bearer <token>on every later request. This is the more common pattern for controller APIs.
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.
Review
Check what you have learned with these review questions.
| Key term | Meaning |
|---|---|
| REST | REpresentational State Transfer; an architectural style for resource-oriented web APIs over HTTP. |
| Stateless | Each request carries all needed information; the server stores no client context. |
| URI | Uniform Resource Identifier; names a resource (for example, /api/v1/devices). |
| CRUD | Create, Read, Update, Delete; the operations mapped to HTTP methods. |
| GET/POST/PUT/PATCH/DELETE | HTTP methods for read/create/replace/partial-update/delete. |
| Status code | Three-digit response code: 2xx success, 4xx client error, 5xx server error. |
| Header | Key/value metadata in a request or response (Content-Type, Accept, Authorization). |
| Bearer token | A credential issued after login, sent in the Authorization header. |
| Base64 | An encoding (not encryption) used to carry credentials or binary data as text. |
- Cisco. CCNA (200-301) Exam Topics, Domain 6.0 Automation and Programmability. cisco.com.
- Fielding, R. Architectural Styles and the Design of Network-based Software Architectures (2000), Chapter 5. ics.uci.edu.
- Fielding, R. & Reschke, J. RFC 7231: HTTP/1.1 Semantics and Content (2014). rfc-editor.org/rfc/rfc7231.
- 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.