RESTCONF
termKept in this browser · My desk
The protocol of RFC (Request for Comments) 8040, built on HTTP (Hypertext Transfer Protocol), that gives programs access to data modelled in YANG, using the datastore concepts of NETCONF (Network Configuration Protocol).
It must run over TLS (Transport Layer Security), finds its root through /.well-known/host-meta, carries data as application/yang-data+json or application/yang-data+xml, and reports errors in a structured ietf-restconf:errors body instead of free text. A plain PATCH merges into an existing resource and refuses to create one that is missing.
RESTCONF is what a YANG model looks like through HTTP (Hypertext Transfer Protocol). RFC (Request for Comments) 8040, published in January 2017 by Andy Bierman, Martin Bjorklund and Kent Watsen, defines it as HTTP methods providing create, read, update and delete (CRUD) operations on a conceptual datastore of YANG-defined data, for models written in YANG 1 or 1.1. It is a Proposed Standard, updated by RFC 8527. The specification is careful about what it is not. It is not intended to replace NETCONF (Network Configuration Protocol) but to offer an interface that follows REST (Representational State Transfer) principles and stays compatible with NETCONF's datastore model, implementing a subset of NETCONF and leaving out explicit locking and the choice of datastore. Nor is it a hypermedia API (application programming interface): responses carry no links to follow, because a client that knows the server's YANG modules can derive every resource address and the structure of every request and response from them. That is the practical difference from a vendor's hand-designed REST API, where the paths come from documentation.
Transport is fixed more tightly than in most HTTP APIs. A server must support TLS (Transport Layer Security), and the protocol must not be used over HTTP without it; implementations must support the https scheme, whose default port is 443, and no particular HTTP version is required, although at least HTTP/1.1 is recommended. The server presents an X.509 version 3 certificate, and the client must either validate its path or match it against a certificate obtained by a trusted mechanism, such as a pinned one. The server must authenticate every client: it should require TLS client certificates and may fall back to an HTTP authentication scheme when certificates are not feasible. What an authenticated user may then read or change is governed by the NETCONF access control model, now RFC 8341. The security considerations add that servers should not accept TLS 1.3 early data (0-RTT) at all, even for idempotent requests. NETCONF itself, by comparison, normally runs over SSH (Secure Shell) on TCP port 830.
A client starts by finding the root. It requests /.well-known/host-meta and reads the one link whose relation is restconf; the value, commonly /restconf, is the prefix of every later request. Under the root sit three things: data, the datastore resource that holds all configuration and state; operations, where each rpc defined in a YANG module is invoked with POST; and yang-library-version, which says which revision of the YANG library the server uses to list its modules. Every server must also implement the ietf-restconf-monitoring module, which reports its capabilities and its event streams.
Paths are the model's tree written as a URI (Uniform Resource Identifier). Node names are joined from the top-level node down, and a module name followed by a colon is put in front of a node whenever the node belongs to a different module than its parent, or sits at the top. A list entry is addressed by the list name, an equals sign and the key value, with the values of several keys separated by commas in the order of the YANG key statement, and reserved characters in a value must be percent-encoded. The interface named eth0 in the standard interfaces model is therefore /restconf/data/ietf-interfaces:interfaces/interface=eth0, and an interface whose name contains slashes has each slash written as %2F. Bodies use the media types application/yang-data+json and application/yang-data+xml, with the JSON (JavaScript Object Notation) rules of RFC 7951: module-qualified member names and 64-bit numbers as strings.
Each method has a fixed meaning, which the specification maps to NETCONF operations. GET and HEAD read. POST on a parent creates a child and fails if it already exists; POST on an operation resource invokes it. PUT creates or replaces the target, answering 201 Created or 204 No Content, and PUT on the datastore resource replaces the entire configuration, the most dangerous request in the protocol. A plain PATCH merges its body into the target: it can create or update children but cannot delete them, and if the target itself does not exist the server must not create it. DELETE removes a resource that must exist. For anything finer there is YANG Patch, RFC 8072 of February 2017, a separate media type (application/yang-patch+json or +xml) carrying an ordered list of edits with seven operations, create, delete, insert, merge, move, replace and remove, applied atomically: if the whole patch cannot be completed, nothing changes. A client learns whether a server supports it from the Accept-Patch field in the reply to an OPTIONS request.
Retrieval is shaped by query parameters, each allowed once per request: content selects configuration, non-configuration or all data, depth limits how far down the reply goes, fields picks out part of the target and with-defaults controls whether default values are returned. Two mechanisms prevent one client from overwriting another's change. The server keeps a last-modified timestamp and an entity-tag for the datastore, returned in the Last-Modified and ETag fields, and a client can make an edit conditional with If-Unmodified-Since or If-Match. Failures come back with a 4xx or 5xx status and a structured errors body that reuses NETCONF's error information, with a defined mapping from error-tag to status code: data-exists, data-missing, in-use and lock-denied are 409, access-denied is 401 or 403, malformed-message is 400, and operation-not-supported is 405 or 501.
Where an edit lands depends on the device. If the server supports a writable running datastore, edits go straight to it. If it works through a candidate datastore instead, the candidate must be committed to running immediately after each successful edit, and any edits other sessions had left in the candidate are committed with it. If the device has a separate startup datastore, the server must update it automatically after running changes, so there is no separate save step. A RESTCONF client cannot take or release locks, and an edit against a datastore locked by a NETCONF session fails with 409 Conflict and the error-tag in-use. Each request is its own edit; there is no way to group several requests into one transaction, which is the main reason to keep NETCONF for large coordinated changes. RFC 8527 (March 2019) added resources under ds for the datastores of the newer architecture, so that a client can read ds/ietf-datastores:operational or ds/ietf-datastores:running explicitly.
Notifications are optional. A server that supports them lists its streams in the monitoring module, and a client receives events by opening a stream with the Accept type text/event-stream, the Server-Sent Events (SSE) transport, optionally with the filter, start-time and stop-time parameters.
Implementations differ in the parts the standard leaves open. Cisco's IOS XE guide enables the service with the restconf and ip http secure-server commands, authenticates through AAA (authentication, authorization and accounting) with users at privilege level 15, and serves the root at /restconf. F5 documents that F5OS accepts the same calls on port 8888 under /restconf and on port 443 under /api, requires the Content-Type application/yang-data+json, and issues an X-Auth-Token that lasts fifteen minutes and can be renewed five times. The recurring mistakes are the same everywhere: a missing module prefix, an unencoded key, a PUT that replaced more than was meant, a PATCH sent to a resource that did not exist yet, and a generic JSON content type where the server expects the YANG one.
Also known as: rfc 8040, yang-data+json, restconf api
Sources
- IETF, RFC 8040, RESTCONF Protocol, A. Bierman, M. Bjorklund and K. Watsen, January 2017 (read 2026-11-12): HTTP-based access to YANG-defined data using NETCONF datastore concepts; a subset of NETCONF, not a replacement; TLS required and https on port 443; client authentication; host-meta discovery of the root; the data and operations resources; path encoding of module names and list keys; the method table; plain PATCH; query parameters; entity-tags; Server-Sent Events; errors in ietf-restconf:errors and the error-tag to status code table; coexistence with NETCONF datastores and locks
- RFC Editor, information page for RFC 8040 (read 2026-11-12): Proposed Standard, updated by RFC 8527
- IETF, RFC 8527, RESTCONF Extensions to Support the Network Management Datastore Architecture, March 2019, updates RFC 8040 (read 2026-11-12): new datastore resources under ds, such as ds/ietf-datastores:operational and ds/ietf-datastores:running
- IETF, RFC 8072, YANG Patch Media Type, February 2017 (read 2026-11-12): the media types application/yang-patch+xml and application/yang-patch+json; an ordered edit list with seven operations (create, delete, insert, merge, move, replace, remove); the request is applied atomically
- IETF, RFC 8341 (STD 91), Network Configuration Access Control Model, March 2018 (read 2026-11-12): obsoletes RFC 6536, the access control model that RFC 8040 names for restricting RESTCONF users
- IETF, RFC 6242, Using the NETCONF Protocol over Secure Shell (SSH), June 2011 (read 2026-11-12): NETCONF over SSH uses the IANA-assigned TCP port 830
- IETF, RFC 7951, JSON Encoding of Data Modeled with YANG, August 2016 (read 2026-11-12): member names qualified with the module name; 64-bit numbers encoded as strings
- Cisco, Programmability Configuration Guide, Cisco IOS XE Dublin 17.12.x, RESTCONF Protocol, updated 28 July 2023 (read 2026-11-12): enabled with the restconf and ip http secure-server commands; connections authenticated with AAA, users at privilege level 15; the root found through /.well-known/host-meta is /restconf; application/yang-data+xml and +json
- F5, F5 rSeries Planning Guide, Automating F5OS on rSeries, CloudDocs (read 2026-11-12): API calls go to port 8888 with the path /restconf or to port 443 with the path /api; the X-Auth-Token has a lifetime of fifteen minutes and can be renewed five times; the Content-Type application/yang-data+json is required; paths such as openconfig-system:system/dns