REST - jibingl/CCNA-CCNP GitHub Wiki
REST or RESTful is a framework for APIs.
Table 1 - REST CRUD Operations
| CRUD | Purpose | HTTP Verb |
|---|---|---|
| Create | Create new variable | POST |
| Read | Retrieve values of variable | GET |
| Update | Change the value of variable | PUT, PATCH |
| Delete | Delete variable | DELETE |
For REST APIs to instruct applications to communicate over network, networking protocol must be used to facilitate the communications. HTTP(s) is the most common choice.
Note: REST APIs and HTTP are both stateless.
URI Unified Resource Identifier: indicates the resource it is trying to access.
Example of URI:
https://sandboxdnac.cisco.com/dna/intent/api/v1/network-device
<----> <-------------------><------------------------------->
Scheme Authority Path
Table 2 - HTTP Responses:
| Code | Facility | Description | Example |
|---|---|---|---|
| 1xx | informational | The request was received, continuing process | 102 processing |
| 2xx | successful | The request has received, understood, and accepted | 200 OK; 201 Created (response to POST) |
| 3xx | redirection | Further action need to be taken in order to complete the request | 301 Moved Permanently |
| 4xx | client error | The request contains bad syntax or can't be fulfilled | 403 Unauthorized; 404 Not Found the resource |
| 5xx | server error | The server failed to fulfill an apparently valid request | 500 Internal Server Error can't handle the request |
- RESTCONF is a specific, standardized implementation of REST principles designed exclusively for network configuration and device management.
- Strictly maps to YANG data models in the backend.
- Data format is limited to JSON and XML.
NETCONF and RESTCONF are both model-driven network management protocols that use YANG schemas to configure and monitor devices.
| Dimension | NETCONF (RFC 6241) | RESTCONF (RFC 8040) |
|---|---|---|
| Transport | SSH (typically port 830) or TLS | HTTP / HTTPS (typically port 443) |
| Data Encoding | XML only | JSON or XML |
| Interaction Model | Stateful, session-based Remote Procedure Calls (RPCs) | Stateless, resource-oriented REST operations |
| Operations |
<get>, <get-config>, <edit-config>, <commit>, <lock>
|
GET, POST, PUT, PATCH, DELETE
|
| Transaction Style | Multi-step transaction (Lock → Edit → Validate → Commit → Unlock) | Single-step request (Immediate execution upon HTTP request receipt) |