In the previous lesson, you configured and managed a router using NETCONF.
You opened an SSH session on port 830, exchanged XML messages, and used the ncclient Python library.
But what if you could do the same thing with a simple HTTPS request?
Figure 1 – NETCONF vs RESTCONF
Same Data, Different Transport
RESTCONF (RFC 8040) provides a REST-like HTTP interface to access YANG-modeled data.
It uses the same YANG models as NETCONF. The data is the same. Only the transport changes.Instead of SSH and XML, RESTCONF uses HTTPS and JSON.
Instead of a dedicated library like ncclient, you can use any HTTP client: Python requests, curl, or even a web browser.Key Differences
RESTCONF is stateless. There is no session, no hello exchange, no capabilities negotiation.
Each request is independent and contains everything the device needs to process it.Unlike NETCONF, RESTCONF has no candidate datastore, no lock, and no commit.
Every change is applied directly to the running datastore.Feature
NETCONF
RESTCONF
Transport
SSH (TCP 830)
HTTPS (TCP 443)
Data encoding
XML
JSON or XML
Data models
YANG
YANG (same models)
Session
Stateful (hello, session-id)
Stateless (no session)
Candidate datastore
Yes (lock, commit)
No (running only)
Python library
ncclient
requests (or any HTTP client)
Table 1 – NETCONF vs RESTCONF
Answer the question below
What transport protocol does RESTCONF use instead of SSH?
RESTCONF maps YANG data to HTTP. You interact with your device by sending HTTP requests to specific URLs.
Each URL points to a resource defined by a YANG model.RESTCONF URI Structure
Every RESTCONF request targets a URI that follows a specific structure.
The URI tells the device exactly what resource you want to read or modify.
Figure 2 – RESTCONF URI structure
The HTTP method (GET, POST, PUT, PATCH, DELETE) defines the action. The URI identifies the resource:
The protocol and host identify your device (e.g.,
https://192.168.1.1)/restconf/datais the API root that tells the device you want to access configuration or operational dataThe YANG resource path maps directly to the YANG model (
module:container/resource/key=value)
HTTP Methods
RESTCONF uses standard HTTP methods. If you remember the CRUD operations from the REST API lesson, this will feel familiar.
Each method maps to a NETCONF operation:HTTP method
CRUD
NETCONF equivalent
GET
Read
<get-config>POST
Create
<edit-config>(operation="create")PUT
Replace
<edit-config>(operation="replace")PATCH
Update
<edit-config>(operation="merge")DELETE
Delete
<edit-config>(operation="delete")Table 2 – HTTP methods mapped to NETCONF operations
What does that look like in practice?
If you want to read the description of GigabitEthernet1, you send a GET to/restconf/data/.../GigabitEthernet=1.
If you want to change it, you send a PATCH to the same URI with the new value in the JSON body.Answer the question below
Which HTTP method is the RESTCONF equivalent of the NETCONF get-config operation?
Request and Response
When you send a GET request to your device, you include an
Acceptheader to tell the device what format you want the response in.
Figure 3 – GET request
The header
Accept: application/yang-data+jsontells R1: "Send me the data in JSON format."
You could also useapplication/yang-data+xmlto receive XML instead.40 % Complete: you’re making great progress
Unlock the rest of this lesson
If you’d like to continue your CCNA journey, simply create your free account.
Access all CCNA lessons
Practice with hands-on labs
Train with Practice exams and Quizzes
Progress tracking in your dashboard
Made by network engineers - CCNP certified
learners globally