Study guide

15.3 RESTCONF Protocol Operations: HTTP Verbs, Datastores, and Response Codes

Cisco ENCOR 350-401 CCNP Enterprise Core

Track your progress as you read

Finished sections get a check mark.

1 Introduction & Exam Overview

0.1 Cisco 350-401 ENCOR Exam Logistics, Blueprint Structure, and Certification Paths 0.2 Preparation Strategy, Lab Environment Setup, and Practical Test Pacing

2 Enterprise Campus Architecture and High Availability

1.1 Enterprise Network Design: Two-Tier, Three-Tier, Fabric, and Cloud Architectures 1.2 High Availability Architecture: Device Redundancy, FHRPs, and Stateful Switchover (SSO) 1.3 Quality of Service (QoS) Architecture, Classification, Queuing, and Configuration Interpretation

3 Cisco Software-Defined Architecture: SD-WAN and SD-Access

2.1 Cisco Catalyst SD-WAN: Control, Management, and Data Planes 2.2 Cisco SD-Access Architecture: Control Plane, Data Plane, and Fabric Node Roles 2.3 SD-Access Campus Interoperability: Integrating Traditional Networks with Fabric

4 Device and Network Virtualization Technologies

3.1 Device Virtualization: Type 1/2 Hypervisors, Virtual Machines, and Virtual Switching 3.2 Data Path Virtualization: VRF-Lite, GRE Tunneling, and IPsec VPN Fundamentals 3.3 Network Virtualization Overlays: LISP and VXLAN Encapsulation Mechanics

5 Layer 2 Infrastructure: Trunking, EtherChannel, and Spanning Tree

4.1 802.1Q Trunking, Native VLAN, and Dynamic Trunking Protocol Troubleshooting 4.2 EtherChannel Bundling: Static, LACP, and PAgP Implementation and Verification 4.3 Spanning Tree Architecture: RSTP, MST, and STP Protection Mechanisms

6 Layer 3 Routing: OSPF Multi-Area and Protocol Comparison

5.1 Enterprise Routing Principles: Distance Vector vs. Link-State, EIGRP, and OSPF 5.2 OSPFv2 and OSPFv3 Multi-Area Architecture: LSAs, Area Types, and Summarization 5.3 Policy-Based Routing (PBR) Architecture, Configuration, and Route-Maps

7 Exterior Routing: BGP Peering and Path Selection

6.1 External BGP (eBGP) Peering, States, Neighbor Adjacencies, and Timers 6.2 BGP Path Attributes and the Step-by-Step Best Path Selection Algorithm

8 IP Services and First-Hop Redundancy

7.1 Time Synchronization: Network Time Protocol (NTP) and Precision Time Protocol (PTP) 7.2 Network Address Translation: Static NAT, Dynamic NAT, and PAT/Overload 7.3 First Hop Redundancy Protocols: HSRP and VRRP Implementation and Failover

9 IP Multicast Architecture and Protocols

8.1 Multicast Addressing, IGMPv2/v3 Host Membership, and the RPF Check 8.2 Protocol Independent Multicast Sparse Mode (PIM-SM) and Rendezvous Point Discovery 8.3 Anycast RP with MSDP, Source-Specific Multicast (SSM), and Bidirectional PIM

10 Network Diagnostics, Monitoring, and Telemetry

9.1 Network Diagnostic Tools: Conditional Debugging, Traceroute, SNMPv3, and Syslog Logging 9.2 Flexible NetFlow (FNF) Architecture: Flow Records, Exporters, and Monitors 9.3 Switched Port Analyzer: Local SPAN, Remote SPAN (RSPAN), and Encapsulated RSPAN (ERSPAN)

11 Performance Monitoring and Model-Driven Assurance

10.1 IP Service Level Agreements (IP SLA) Probes, Responder, and Route Tracking 10.2 Cisco Catalyst Center: Assurance Dashboards, AI Analytics, and Machine Reasoning Workflows 10.3 Model-Driven Telemetry and Programmable Interfaces: NETCONF and RESTCONF Verification

12 Device Access Control and AAA Architecture

11.1 Device Line Protection: Console, Aux, VTY, Local Authentication, and Privilege Levels 11.2 AAA Architecture: Comparing RADIUS vs. TACACS+ and Method List Configuration

13 Infrastructure Security: ACLs, CoPP, and API Security

12.1 IPv4 and IPv6 Access Control Lists (ACLs): Standard, Extended, and Named Rules 12.2 Control Plane Policing (CoPP): Protecting the Route Processor with MQC 12.3 REST API Security: Token Authentication, TLS Transport, and Rate Limiting

14 Enterprise Network Security Design: ISE, TrustSec, and MACsec

13.1 Endpoint Security Architecture: 802.1X, Cisco ISE Posture, and Profiling 13.2 Next-Generation Firewalls (FTD) and Enterprise Threat Defense Design 13.3 Cisco TrustSec (Security Group Tags) and MACsec (802.1AE) Layer 2 Encryption

15 Network Automation Fundamentals: Python, JSON, and YANG

14.1 Python Fundamentals for Network Engineers: Data Types, Control Flow, and Libraries 14.2 JSON Data Encoding: Syntax, Formatting Rules, and Python Serialization 14.3 YANG Data Modeling: Modules, Tree Structures, and Data Representation

16 Controller REST APIs and RESTCONF Implementation

15.1 Cisco Catalyst Center Intent APIs and Authentication Workflows 15.2 Cisco Catalyst SD-WAN Manager (vManage) REST APIs and Device Interaction 15.3 RESTCONF Protocol Operations: HTTP Verbs, Datastores, and Response Codes

17 Event-Driven Automation and Infrastructure Orchestration

16.1 Cisco Embedded Event Manager (EEM) Applet Architecture and Event Detectors 16.2 Configuration Management: Comparing Ansible, Puppet, Chef, and SaltStack 16.3 Infrastructure as Code (IaC) Principles with Terraform in Enterprise Networks

15.3 RESTCONF Protocol Operations: HTTP Verbs, Datastores, and Response Codes

Key Takeaways Explain This Topic AI

RESTCONF (RFC 8040) is an HTTP-based, stateless protocol providing programmatic access to YANG-modeled configuration and operational data, serving as a lightweight alternative to NETCONF.

Operating over HTTPS on TCP port 443, RESTCONF supports both JSON (application/yang-data+json) and XML (application/yang-data+xml) structured payloads negotiated via Content-Type and Accept headers.

The RESTCONF root resource is discovered via GET /.well-known/host-meta and exposes three primary entry points: /restconf/data for datastore read/write access, /restconf/operations for Remote Procedure Calls, and /restconf/yang-library-version for schema metadata.

Standard HTTP verbs map directly to datastore operations: GET retrieves data, POST creates child resources or invokes RPCs, PUT creates or completely replaces a resource, PATCH merges/updates partial data, and DELETE removes resources.

HTTP response status codes signal transaction outcomes deterministically, including 200 OK (successful query), 201 Created (resource created by POST or PUT), 204 No Content (successful deletion/empty body), 400 Bad Request (syntax/schema error), 401 Unauthorized, 404 Not Found, and 409 Conflict (resource exists or datastore lock).

Last updated: October 2026

RESTCONF Protocol Operations: HTTP Verbs, Datastores, and Response Codes

As enterprise networks shifted toward programmatic infrastructure management, the Internet Engineering Task Force (IETF) standardized NETCONF (Network Configuration Protocol, RFC 6241) and YANG (Yet Another Next Generation data modeling language, RFC 6020 / RFC 7950) to replace unstructured CLI screen-scraping and SNMP. While NETCONF successfully established a robust, transaction-safe, model-driven foundation, its reliance on XML-only encoding and stateful SSH transport sessions over TCP port 830 created integration challenges for cloud-native applications, web developers, and lightweight automation scripts that standardly operate over web protocols. To bridge this gap, the IETF developed RESTCONF ( RFC 8040 ), defining an HTTP-based, stateless protocol that provides programmatic access to YANG-modeled network configuration and operational state. +-------------------------------------------------------------------------+

  • | Model-Driven Interface Protocol Comparison |
  • +-------------------------------------------------------------------------+
  • | |
  • | +-----------------------------------------------------------------+ |
  • | | YANG Data Models (Schema Contract) | |
  • | | - Cisco Native Models (Cisco-IOS-XE-native.yang) | |
  • | | - OpenConfig Models (openconfig-interfaces.yang) | |
  • | | - IETF Models (ietf-interfaces.yang - RFC 8343) | |
  • | +-----------------------------------------------------------------+ |
  • | | | |
  • | v v |
  • | +---------------------------+ +-----------------------------+ |
  • | | NETCONF (RFC 6241) | | RESTCONF (RFC 8040) | |
  • | | - Transport: SSH (TCP 830)| | - Transport: HTTPS (TCP 443)| |
  • | | - Encoding: Strictly XML | | - Encoding: JSON or XML | |
  • | | - Protocol: Stateful RPCs | | - Protocol: Stateless REST | |
  • | | - Operations: <get-config>| | - Operations: GET, POST, | |
  • | | <edit-config>, <commit> | | PUT, PATCH, DELETE | |
  • | +---------------------------+ +-----------------------------+ |
  • | | | |
  • | +-----------------+-----------------+ |
  • | | |
  • | v |
  • | +-----------------------------------------------------------------+ |
  • | | Cisco IOS XE Device Datastores (Unified Data Store) | |
  • | | Running Datastore | Candidate Datastore | Operational State| |
  • | +-----------------------------------------------------------------+ |
  • +-------------------------------------------------------------------------+
  • Protocol Architecture: RESTCONF vs. NETCONF

RESTCONF does not replace NETCONF; rather, it provides a RESTful alternative interface accessing the exact same underlying YANG data models and system datastores. Understanding their architectural differences is vital when designing automation pipelines:

Transport Mechanism: NETCONF uses a persistent, stateful SSH subsystem running on TCP port 830 (RFC 6242), requiring ongoing connection maintenance and capability exchanges ( <hello> ). RESTCONF uses stateless HTTPS connections over standard TCP port 443 (or HTTP on port 80 in lab environments), easily traversing corporate firewalls and application proxies.

Data Serialization: NETCONF strictly mandates XML-encoded payloads. RESTCONF natively supports both JSON and XML . Because JSON produces substantially smaller payloads and maps directly to native dictionaries and lists in Python, JavaScript, and Go, it is the preferred serialization format in modern automation.

Media Types and Headers: RESTCONF defines distinct MIME media types for content negotiation:

For JSON: application/yang-data+json

For XML: application/yang-data+xml Automation clients use the Content-Type request header to specify the format of the data being sent to the router, and the Accept header to declare the format expected in the response.

NETCONF vs. RESTCONF Architectural Comparison

  • Dimension NETCONF (RFC 6241) RESTCONF (RFC 8040)
  • Transport Layer SSH (RFC 6242) or TLS HTTPS (HTTP over TLS)
  • Default Port TCP 830 TCP 443
  • Session Architecture Stateful connection with <hello> negotiation Stateless per-request transaction
  • Wire Data Formats Strictly XML JSON ( yang-data+json ) or XML ( yang-data+xml )
  • Operations Paradigm Remote Procedure Calls ( <rpc> ) Standard HTTP Methods (GET, POST, PUT, PATCH, DELETE)
  • Transaction Support Multi-phase commit, explicit <lock> Atomic per-request; endpoint dependent
  • Schema Contract YANG (RFC 6020 / RFC 7950) YANG (RFC 6020 / RFC 7950)
  • Root Resource Discovery and URI Anatomy

RESTCONF organizes all network data hierarchically into a conceptual datastore addressable via Uniform Resource Identifiers (URIs). +-------------------------------------------------------------------------+

  • | RESTCONF URI Structural Anatomy |
  • +-------------------------------------------------------------------------+
  • https://10.1.1.1/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet1
  • \______________/\_______/\___/\_________________________/\_________________________/
  • | | | | |
  • Scheme & Root Resource YANG Module & List Entry &
  • Host/Port Path Type Top-Level Container Unique Key
  • 1. Root Resource Discovery ( /.well-known/host-meta )

RFC 8040 mandates discovery of the RESTCONF API root resource via the standard Web Host Metadata mechanism (RFC 6415). A client initiates discovery by querying: GET /.well-known/host-meta HTTP/1.1

  • Host: router.example.com
  • Accept: application/xrd+xml

The network device responds with an Extensible Resource Descriptor (XRD) document containing a link relation pointing to the RESTCONF entry point, typically /restconf : <XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>

  • <Link rel='restconf' href='/restconf'/>
  • </XRD>
  • 2. Top-Level Entry Points under /restconf

Under the /restconf root URI, the device provides three standard resource entry points:

/restconf/data : The primary operational resource. Represents the unified configuration and operational datastore for all loaded YANG models.

/restconf/operations : The entry point for executing YANG-modeled Remote Procedure Calls (such as triggering an operating system reload, clearing interface counters, or restarting a routing process).

/restconf/yang-library-version : Reports the version of the IETF YANG Library specification implemented by the device (e.g., "2019-01-04" ). The full catalog of supported YANG modules, revisions, and feature sets can be queried at /restconf/data/ietf-yang-library:yang-library .

3. URI Path Parameters and Query Options

To target specific data subtrees, URIs follow the YANG schema path:

module-name:container : The top container must be prefixed with the YANG module identifier to avoid naming collisions (e.g., ietf-interfaces:interfaces vs Cisco-IOS-XE-native:native ).

list=key : Lists are indexed by specifying the key leaf after an equals sign (e.g., interface=GigabitEthernet1 or neighbor=10.1.1.2 ).

Clients append query parameters to control output scope:

?content=config : Returns only configuration data ( config true nodes). Matches NETCONF <get-config> .

?content=nonconfig : Returns only operational state data ( config false nodes, such as hardware counters). Matches operational filtering in NETCONF <get> .

?content=all : Returns both configuration and operational state data (default behavior).

?depth=N : Limits the nesting depth of returned JSON/XML trees to N levels, preventing massive payload downloads on large modular switches.

?fields=leaf1;leaf2 : Selectively filters the response to include only specific attributes.

Mapping HTTP Verbs to Datastore Operations

RESTCONF maps standard HTTP methods deterministically to YANG datastore transactions and NETCONF equivalents: +-------------------------------------------------------------------------+

  • | HTTP Verbs to Datastore Operations Mapping |
  • +-------------------------------------------------------------------------+
  • HTTP Verb Target Resource URI Datastore Operation
  • -------- ------------------- -------------------
  • GET /data/.../interface=Gi1 Retrieve configuration/state
  • (NETCONF: <get>, <get-config>)
  • POST /data/.../interfaces Create new child list entry
  • /operations/cisco-ia:save-config Invoke YANG RPC
  • PUT /data/.../interface=Loopback1 Create or REPLACE resource
  • (Overwrites entire entity)
  • PATCH /data/.../interface=Gi1 MERGE partial modification
  • (Leaves siblings intact)
  • DELETE /data/.../interface=Loopback1 Remove target resource
  • (NETCONF: operation="delete")
  • Detailed HTTP Method Semantics
  • 1. GET (Retrieve Data)

Retrieves configuration and/or operational state from the target resource. Does not modify the datastore. Depending on the ?content parameter, GET functions as a NETCONF <get-config> or <get> .

2. POST (Create Child or Execute RPC)

Serves two distinct functions in RESTCONF:

Resource Creation: When targeted at a parent data container or list resource, POST creates a new child resource. Crucially, the resource must not already exist . If the resource already exists in the datastore, the server rejects the request with an HTTP 409 Conflict error.

RPC Invocation: When targeted at a resource under /restconf/operations , POST executes a defined RPC action (such as saving running-config to startup-config).

3. PUT (Create or Replace Target Resource)

Creates or completely replaces the target resource at the exact URI specified. Unlike POST (which targets the parent), PUT targets the exact resource URI. If the resource does not exist, it is created. If it already exists, the entire resource is overwritten . Any configuration leaves omitted from the request body are either deleted or reset to their schema defaults.

4. PATCH (Merge / Partial Modification)

Applies partial modifications to the target resource without replacing omitted sibling elements. PATCH corresponds directly to NETCONF's default <edit-config> behavior with operation="merge" . If an engineer wants to update an interface description without altering its IP address, MTU, or administrative shutdown state, PATCH is the appropriate method. RFC 8072 also defines YANG Patch , an advanced mechanism for executing atomic multi-operation patches.

5. DELETE (Remove Resource)

Deletes the target data resource from the datastore. Corresponds to NETCONF <edit-config> with operation="delete" . If the targeted resource does not exist, the request fails with an error instead of silently succeeding.

HTTP Verbs to NETCONF RPC Mapping Reference

HTTP Verb Target Resource Datastore Semantics NETCONF Equivalent Idempotent?

  • GET Data node Read configuration / operational data <get-config> , <get> Yes
  • POST Parent container Create new child resource (fails if exists) <edit-config> ( operation="create" ) No
  • POST /operations/... Execute remote procedure call (RPC) <rpc> invocation No
  • PUT Target data URI Create or completely replace resource <edit-config> ( operation="replace" ) Yes
  • PATCH Target data URI Merge attributes without deleting siblings <edit-config> ( operation="merge" ) Yes
  • DELETE Target data URI Remove the target resource from datastore <edit-config> ( operation="delete" ) Yes
  • HTTP Response Status Codes in RESTCONF

RESTCONF servers return standardized HTTP status codes to communicate transaction outcomes:

Success Codes (2xx)

200 OK : The request succeeded and the response has a body. Returned for successful GET requests and for a PATCH that returns data.

201 Created : A new data resource was created, either by POST or by a PUT that targeted a resource that did not yet exist. The response includes a Location header containing the absolute URI of the newly created resource.

204 No Content : The request succeeded, but the server returns no message body. Standard for successful DELETE operations, as well as PUT or PATCH updates where no body is returned.

Client Error Codes (4xx)

400 Bad Request : The request payload violates syntax rules, contains invalid JSON/XML formatting, or breaches YANG schema constraints (e.g., providing a VLAN ID of 5000 when the schema restricts values to 1–4094).

401 Unauthorized : The request lacked authentication credentials or provided invalid credentials (e.g., bad HTTP Basic Auth username/password).

403 Forbidden : The authenticated user has insufficient permissions to perform the requested operation (e.g., AAA privilege level or RBAC restrictions).

404 Not Found : The requested URI path does not exist in the YANG datastore.

409 Conflict : A conflict occurred. Triggered when a POST request attempts to create a resource that already exists, or when a datastore lock contention prevents an edit.

Server Error Codes (5xx)

500 Internal Server Error : The router operating system or RESTCONF subsystem encountered an unrecoverable internal error or crash while processing the transaction.

RESTCONF HTTP Response Status Codes Reference

  • Status Code Status Name Operational Trigger / Meaning in RESTCONF
  • 200 OK Success GET retrieved data, or a PATCH returned a response body
  • 201 Created Created POST created a child resource (with a Location header), or PUT created a new resource
  • 204 No Content No Content DELETE succeeded, or PUT / PATCH executed without returning response body
  • 400 Bad Request Client Error Malformed JSON/XML syntax or YANG constraint violation (range, pattern, type)
  • 401 Unauthorized Auth Error Missing, malformed, or invalid authentication credentials
  • 403 Forbidden Access Denied Authenticated user lacks RBAC permissions or AAA command authorization
  • 404 Not Found Not Found Requested URI path or list entry key does not exist in datastore
  • 409 Conflict Conflict POST resource already exists, or datastore lock/concurrency conflict
  • 500 Server Error System Error Device management daemon failure or operating system internal error
  • Practical Python RESTCONF Script Walkthrough

The following Python script interacts with a Cisco IOS XE router via RESTCONF. It demonstrates querying interface configuration and operational counters ( GET ), modifying the interface description without affecting existing parameters ( PATCH ), and verifying status codes: import json

  • import requests
  • from requests.auth import HTTPBasicAuth
  • import urllib3
  • # Suppress TLS certificate warnings for lab environments
  • urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  • ROUTER_IP = "10.1.1.1"
  • USERNAME = "cisco"
  • PASSWORD = "cisco123!"
  • BASE_URL = f"https://{ROUTER_IP}/restconf"
  • # Define standard RESTCONF media types
  • RESTCONF_HEADERS = {
  • "Accept": "application/yang-data+json",
  • "Content-Type": "application/yang-data+json"
  • }

def get_interface_state(interface_name):

  • """Retrieves configuration and operational state using GET with ?content=all."""
  • url = f"{BASE_URL}/data/ietf-interfaces:interfaces/interface={interface_name}"
  • params = {"content": "all"}
  • response = requests.get(
  • url,
  • headers=RESTCONF_HEADERS,
  • auth=HTTPBasicAuth(USERNAME, PASSWORD),
  • params=params,
  • verify=False,
  • timeout=10
  • )

if response.status_code == 200:

  • data = response.json()
  • intf = data.get("ietf-interfaces:interface", {})
  • print(f"Interface: {intf.get('name')}")
  • print(f" Description: {intf.get('description', 'None configured')}")
  • print(f" Admin Enabled: {intf.get('enabled')}")
  • print(f" Operational Status: {intf.get('oper-status')}")
  • return data

elif response.status_code == 404:

  • print(f"Interface {interface_name} not found on device (HTTP 404).")
  • return None

else:

  • print(f"Error retrieving interface: HTTP {response.status_code}")
  • response.raise_for_status()

def update_interface_description(interface_name, new_description):

  • """Merges a new description using PATCH without overwriting existing settings."""
  • url = f"{BASE_URL}/data/ietf-interfaces:interfaces/interface={interface_name}"
  • payload = {
  • "ietf-interfaces:interface": {
  • "name": interface_name,
  • "description": new_description
  • }
  • }
  • response = requests.patch(
  • url,
  • headers=RESTCONF_HEADERS,
  • auth=HTTPBasicAuth(USERNAME, PASSWORD),
  • json=payload,
  • verify=False,
  • timeout=10
  • )

# Successful PATCH operations typically return 200 OK or 204 No Content

if response.status_code in [200, 204]:

print(f"Successfully updated description on {interface_name} (HTTP {response.status_code}).")

elif response.status_code == 400:

print("HTTP 400 Bad Request: Check payload structure and YANG schema constraints.")

elif response.status_code == 409:

print("HTTP 409 Conflict: Datastore is currently locked or conflicting edit.")

else:

  • print(f"Failed to update interface: HTTP {response.status_code}")
  • print(response.text)

if __name__ == "__main__":

target_intf = "GigabitEthernet1"

  • print("--- 1. Querying Interface State Before Update ---")
  • get_interface_state(target_intf)
  • print("\n--- 2. Applying Partial Update via PATCH ---")
  • new_desc = "Uplink-to-Core-Switch-01 [Updated-via-RESTCONF]"
  • update_interface_description(target_intf, new_desc)
  • print("\n--- 3. Verifying Updated State ---")
  • get_interface_state(target_intf)