REST vs NETCONF vs RESTCONF and YANG

Updated October 9, 2026

The rule: YANG is the model, NETCONF and RESTCONF are two ways to reach it

A plain REST API is whatever a vendor decided to publish: its own URLs, its own JSON fields, usually on a controller. NETCONF (RFC 6241) and RESTCONF (RFC 8040) are standard protocols that configure a device from a YANG data model instead of CLI text. NETCONF speaks XML remote procedure calls over SSH; RESTCONF maps the same YANG data onto HTTPS methods with JSON or XML bodies. The decision rule for exam questions: if the question says XML over SSH, port 830, or candidate datastore and commit, the answer is NETCONF; if it says HTTP methods, URLs and JSON against a YANG-modelled device, it is RESTCONF; if it says a controller or cloud service with its own documented endpoints, it is a REST API.

One change, three interfaces

The task: set the description of interface GigabitEthernet1 on an IOS XE router to uplink. The data lives in the standard ietf-interfaces YANG module.

NETCONF sends an XML <rpc> over an SSH session. This one writes to the running datastore, which needs the device to advertise the writable-running capability (many devices want the candidate datastore plus a <commit> instead):

<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target><running/></target>
    <config>
      <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
        <interface>
          <name>GigabitEthernet1</name>
          <description>uplink</description>
        </interface>
      </interfaces>
    </config>
  </edit-config>
</rpc>

The reply is <rpc-reply> containing <ok/>.

RESTCONF expresses the same thing as an HTTP request. PATCH merges, so only the description changes:

PATCH https://r1.example.net/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet1
Content-Type: application/yang-data+json

{ "ietf-interfaces:interface": [ { "name": "GigabitEthernet1", "description": "uplink" } ] }

A successful plain patch returns 204 No Content when there is no response body (200 OK when there is one). The list key (interface=GigabitEthernet1) is in the URL and must match the body. In JSON a list entry is written as an array, even when the URL selects a single entry, which is how the RFC 8040 examples encode it.

A vendor REST API, for example a controller, would use whatever path its documentation defines, such as PUT /api/v1/devices/{id}/interfaces/{name} with its own JSON. Nothing about it is standardised, so there is no YANG and no capability negotiation. See REST API basics for the HTTP side.

What YANG actually describes

YANG (RFC 7950) is a modelling language, not a protocol and not a data format. A module is built from a few node types:

YANG nodeMeaningIn the example
containerA grouping with no value of its owninterfaces
listRepeated entries identified by a keyinterface, key name
leafOne value with a typedescription
leaf-listA list of plain valuesa list of DNS server addresses

Nodes marked config false are operational state (counters, status) and can be read but not written. Because every vendor can implement the same standard module, a script written against ietf-interfaces works across devices that support it; native vendor modules (Cisco publishes its IOS XE models on GitHub) cover features the standard modules do not. This is the reason model-driven programmability exists: structured data in, structured data out, no screen scraping. How the structured data is written (JSON, XML) is covered in JSON vs YAML vs XML.

The three side by side

REST API (vendor)NETCONFRESTCONF
Defined byThe vendor’s documentationRFC 6241RFC 8040
TransportHTTPSSSH, TCP port 830 by default (RFC 6242)HTTPS
EncodingUsually JSONXML onlyJSON or XML (application/yang-data+json or +xml)
Data modelVendor-definedYANGYANG
OperationsHTTP methodsget, get-config, edit-config, copy-config, lock, commitGET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD
DatastoresNonerunning, plus candidate and startup if advertisedEdits land in running (a candidate is committed automatically after each edit)
TransactionsPer requestLock, candidate, commit, rollback on errorEach edit is committed on its own; no locks and no multi-request commit
Typical userController automationConfiguration management, orchestration (Cisco NSO)Python scripts, anyone who already uses HTTP tools

Two RESTCONF details are testable. The POST method creates a child resource inside the target and returns 201 Created with a Location header; PUT creates or replaces the target resource itself, returning 201 if new and 204 if it replaced something. And a RESTCONF client finds the root by fetching /.well-known/host-meta, though on IOS XE the root is normally /restconf.

Which exams test this

ExamHow it appearsCovered on this site
200-901Cisco Platforms and Development: apply model-driven programmability (YANG, RESTCONF, NETCONF) in a Cisco environment and describe the device-level APIs of IOS XE and NX-OS. Infrastructure and Automation: describe the value of model-driven programmability, interpret a RESTCONF or NETCONF query result and a basic YANG model. Network Fundamentals adds the NETCONF port among the common port valuesCisco platforms explained, infrastructure and automation explained
200-301Only the REST part, and only in v1.1 (until Feb 2, 2027): Automation and Programmability asks you to describe REST-based APIs (authentication types, CRUD, HTTP verbs, data encoding). NETCONF, RESTCONF and YANG are not in either version; v2.0 (from Feb 3, 2027) has no REST objective at allCCNA 200-301 AI and operations explained

The comparison is a 200-901 topic. A CCNA v1.1 candidate needs only the REST row of the table, and a CCNA v2.0 candidate none of it.

How questions are built around it

The usual trap is mixing up the transport and the encoding. Constraint words that decide the answer:

  • “XML” plus “SSH” or “830”: NETCONF. RESTCONF never uses SSH, and NETCONF never uses JSON.
  • “HTTP verbs” plus “YANG”: RESTCONF, not a plain REST API.
  • “Candidate”, “lock”, “commit”, “roll back”: NETCONF’s transactional model.
  • “Screen scraping”, “CLI parsing”: the problem all three model-driven options replace.
  • “Defines the structure of configuration data”: YANG, not NETCONF. A distractor often offers YANG as a protocol.
  • “Controller”, “dashboard API” with named endpoints: REST, not RESTCONF.

Reply questions give you a fragment and ask which interface produced it. Namespaces (xmlns="urn:ietf:params:xml:ns:...") and <rpc-reply> mean NETCONF; a JSON key like ietf-interfaces:interface (module name, colon, node) means RESTCONF.

Practice questions

Question 1. A script must read the configuration of an IOS XE switch over HTTPS, receive JSON that follows a YANG model, and change a single interface description with one HTTP request. Which interface should it use?

  • A. NETCONF
  • B. CLI over SSH with screen scraping
  • C. RESTCONF
  • D. YANG
Show answer

Answer: C

RESTCONF exposes YANG-modelled data through HTTP methods over HTTPS and can return JSON, and a PATCH changes one node. NETCONF is model driven but uses XML over SSH, not HTTP and JSON. A CLI session over SSH returns unstructured text. YANG alone is a modelling language, not an interface a script can call.

Question 2. An engineer must push a change to several devices so that nothing is applied unless every edit validates, using a staged datastore that is committed at the end. Which protocol and mechanism fit?

  • A. RESTCONF with a PUT to each device
  • B. NETCONF using the candidate datastore and commit
  • C. A vendor REST API with GET requests
  • D. YANG with the config false statement
Show answer

Answer: B

NETCONF supports a candidate datastore with locking, validation and a commit operation, which gives the all-or-nothing staging described. RESTCONF commits each edit on its own to the running configuration and has no locks or multi-step commit. A vendor REST API has no standard datastore concept. YANG describes data and does not stage changes.

Go deeper