<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt"?>
<!DOCTYPE rfc SYSTEM 'rfc2629.dtd'>
<?rfc toc="yes"?>
<?rfc compact="no"?>
<?rfc subcompact="no"?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes"?>
<?rfc iprnotified="no"?>
<?rfc strict="yes"?>
<rfc ipr="trust200902"   category="std"
    docName="draft-ietf-netconf-restconf-09" >
    <front>
    <title abbrev="RESTCONF">RESTCONF Protocol</title>

    <author initials="A" surname="Bierman" fullname='Andy Bierman' >
      <organization>YumaWorks</organization>
      <address>
        <email>andy@yumaworks.com</email>
      </address>
    </author>
    <author initials="M" surname="Bjorklund" fullname='Martin Bjorklund' >
      <organization>Tail-f Systems</organization>
      <address>
        <email>mbj@tail-f.com</email>
      </address>
    </author>
    <author initials="K" surname="Watsen" fullname='Kent Watsen' >
      <organization>Juniper Networks</organization>
      <address>
        <email>kwatsen@juniper.net</email>
      </address>
    </author>
	<date/>
    <abstract>
	<t>
This document describes an HTTP-based protocol that provides
a programmatic interface for accessing data defined in YANG,
using the datastores defined in NETCONF.
	</t>
</abstract>
</front>
<middle>
<section title="Introduction" anchor="introduction">
    <t>
There is a need for standard mechanisms to allow Web applications
to access the configuration data, operational data,
data-model specific protocol operations, and event notifications
within a networking device, in a modular and extensible manner.
    </t>
    <t>
This document describes an HTTP <xref target="RFC7230"/> based protocol called
RESTCONF, for accessing data defined in YANG version 1 <xref target="RFC6020"/> or
YANG version 1.1 <xref target="I-D.ietf-netmod-rfc6020bis"/>, using datastores defined
in NETCONF <xref target="RFC6241"/>.
    </t>
    <t>
The NETCONF protocol defines configuration datastores and
a set of Create, Retrieve, Update, Delete (CRUD) operations
that can be used to access these datastores.  The YANG language
defines the syntax and semantics of datastore content,
operational data, protocol operations, and event notifications.
RESTCONF uses HTTP operations to provide CRUD operations on a
NETCONF datastore containing YANG-defined data.  Since NETCONF
protocol operations are not relevant, the user should
not need any prior knowledge of NETCONF in order to use RESTCONF.
    </t>
    <t>
Configuration data and state data are exposed as resources that
can be retrieved with the GET method.
Resources representing configuration data
can be modified with the DELETE, PATCH, POST, and PUT methods.
Data is encoded with either XML <xref target="W3C.REC-xml-20081126"/>
or JSON <xref target="RFC7158"/>.
    </t>
    <t>
Data-model specific operations defined with the YANG &quot;rpc&quot; or
&quot;action&quot; statements can be invoked with the POST method.  Data-model
specific event notifications defined with the YANG &quot;notification&quot;
statement can be accessed.
    </t>
<section title="Simple Subset of NETCONF Functionality" anchor="simple-subset-of-netconf-functionality">
    <t>
An HTTP-based management protocol does not need to mirror the functionality
of the NETCONF protocol, but it needs to be compatible with NETCONF.
A simplified transaction model is needed that allows basic
CRUD operations on a hierarchy of conceptual resources.
This represents a limited subset of the transaction capabilities
of the NETCONF protocol.
    </t>
    <t>
The HTTP POST, PUT, PATCH, and DELETE methods are used to
edit data resources represented by YANG data models.
These basic edit operations allow the running configuration
to be altered in an all-or-none fashion.  This is similar
to the &quot;rollback&#8209;on&#8209;error&quot; capability in NETCONF. Edits are
usually applied to one data resource instance at a time.
    </t>
    <t>
The base RESTCONF protocol is intentionally simple to allow
deployment for as many use cases as possible.  Additional
functionality can be defined in external documents, outside the
scope of this document.
    </t>
    <t>
RESTCONF is not intended to replace NETCONF, but rather provide
an additional simplified interface that follows REST principles and
is compatible with a resource-oriented device abstraction.
    </t>
    <t>
The following figure shows the system components:
    </t>
	<figure>
	    <artwork><![CDATA[
      +-----------+           +-----------------+
      |  Web app  | <-------> |                 |
      +-----------+   HTTP    | network device  |
                              |                 |
      +-----------+           |   +-----------+ |
      |  NMS app  | <-------> |   | datastore | |
      +-----------+  NETCONF  |   +-----------+ |
                              +-----------------+
	    ]]></artwork>
	</figure>
</section>
<section title="Data Model Driven API" anchor="data-model-driven-api">
    <t>
RESTCONF combines the simplicity of the HTTP protocol with the
predictability and automation potential of a schema-driven API.
Using YANG, a client can predict all resource endpoints, much
like using URI Templates <xref target="RFC6570"/>, but in a more holistic
manner.   This strategy obviates the need for responses provided
by the server to contain HATEOAS links, originally described in
Roy Fielding&apos;s doctoral dissertation <xref target="rest-dissertation"/>.
    </t>
    <t>
In contrast, a REST client using HATEOAS principles would not use any
data modeling language to define the application-specific content of
the API.  The client would need to discover each new child resource as
it traverses the URIs to discover the server capabilities.  This
approach has the following significant weaknesses with regards to
control of complex networking devices:
    </t>
<t>
 <list style="symbols">
 <t>
inefficient performance: configuration APIs will be quite
complex and may require thousands of protocol messages to
discover all the schema information.  Typically the
data type information has to be passed in the protocol messages,
which is also wasteful overhead.
 </t>
 <t>
no data model richness: without a data model, the schema-level
semantics and validation constraints are not available to the
application.
 </t>
 <t>
no tool automation: API automation tools need some sort of
content schema to function.  Such tools can automate
various programming and documentation tasks related
to specific data models.
 </t>
 </list>
</t>
    <t>
Data models such as YANG modules serve as an &quot;API contract&quot;
that will be honored by the server.  An application designer
can code to the data model, knowing in advance important details
about the exact protocol operations and datastore content
a conforming server implementation will support.
    </t>
    <t>
RESTCONF provides the YANG module capability information
supported by the server, in case the client wants to use it.
The URIs for custom protocol operations and datastore content
are predictable, based on the YANG module definitions.
    </t>
    <t>
Operational experience with CLI and SNMP indicates that
operators learn the location of specific service
or device related data and do not expect such information
to be arbitrary and discovered each time the
client opens a management session to a server.
    </t>
    <t>
The RESTCONF protocol operates on a conceptual datastore defined with
the YANG data modeling language.  The server lists each YANG
module it supports using the &quot;ietf&#8209;yang&#8209;library&quot;
YANG module, defined in <xref target="I-D.ietf-netconf-yang-library"/>.
The server MUST implement the &quot;ietf&#8209;yang&#8209;library&quot; module,
which MUST identify all the YANG modules used by the server.
    </t>
    <t>
The conceptual datastore contents, data-model-specific
operations and event notifications are identified by this set of
YANG modules.  All RESTCONF content identified
as either a data resource, operation resource, or event stream resource
is defined with the YANG language.
    </t>
    <t>
The classification of data as configuration or
non-configuration is derived from the YANG &quot;config&quot; statement.
Data ordering behavior is derived from the YANG &quot;ordered&#8209;by&quot;
statement.
    </t>
    <t>
The RESTCONF datastore editing model is simple and direct,
similar to the behavior of the :writable-running
capability in NETCONF. Each RESTCONF edit of a datastore
resource is activated upon successful completion of the transaction.
    </t>
</section>
<section title="Coexistence with NETCONF" anchor="netconf-coexistence">
    <t>
RESTCONF can be implemented on a device that supports NETCONF.
    </t>
    <t>
If the device supports :writable-running, all edits to configuration
nodes in {+restconf}/data are performed in the running configuration
datastore.
    </t>
    <t>
Otherwise, if the device supports :candidate, all edits to
configuration nodes in {+restconf}/data are performed in the candidate
configuration datastore.  The candidate is automatically committed to
running after a successful edit.
    </t>
    <t>
If the device supports :startup, the device automatically copies the
content of running to startup after running has been updated as
a consequence of a RESTCONF edit operation.
    </t>
    <t>
If a datastore that would be modified by a RESTCONF operation has an
active lock, the RESTCONF edit operation MUST fail with a 409
(Conflict) error code.
    </t>
</section>
<section title="Terminology" anchor="terminology">
    <t>
The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;,
&quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and
&quot;OPTIONAL&quot; in this document are to be interpreted as described in BCP
14, <xref target="RFC2119"/>.
    </t>
<section title="NETCONF" anchor="netconf">
    <t>
The following terms are defined in <xref target="RFC6241"/>:
    </t>
<t>
 <list style="symbols">
 <t>
candidate configuration datastore
 </t>
 <t>
client
 </t>
 <t>
configuration data
 </t>
 <t>
datastore
 </t>
 <t>
configuration datastore
 </t>
 <t>
protocol operation
 </t>
 <t>
running configuration datastore
 </t>
 <t>
server
 </t>
 <t>
startup configuration datastore
 </t>
 <t>
state data
 </t>
 <t>
user
 </t>
 </list>
</t>
</section>
<section title="HTTP" anchor="http">
    <t>
The following terms are defined in <xref target="RFC3986"/>:
    </t>
<t>
 <list style="symbols">
 <t>
fragment
 </t>
 <t>
path
 </t>
 <t>
query
 </t>
 </list>
</t>
    <t>
The following terms are defined in <xref target="RFC7230"/>:
    </t>
<t>
 <list style="symbols">
 <t>
header
 </t>
 <t>
message-body
 </t>
 <t>
request-line
 </t>
 <t>
request URI
 </t>
 <t>
status-line
 </t>
 </list>
</t>
    <t>
The following terms are defined in <xref target="RFC7231"/>:
    </t>
<t>
 <list style="symbols">
 <t>
method
 </t>
 <t>
request
 </t>
 <t>
resource
 </t>
 </list>
</t>
    <t>
The following terms are defined in <xref target="RFC7232"/>:
    </t>
<t>
 <list style="symbols">
 <t>
entity tag
 </t>
 </list>
</t>
</section>
<section title="YANG" anchor="yang">
    <t>
The following terms are defined in <xref target="I-D.ietf-netmod-rfc6020bis"/>:
    </t>
<t>
 <list style="symbols">
 <t>
action
 </t>
 <t>
container
 </t>
 <t>
data node
 </t>
 <t>
key leaf
 </t>
 <t>
leaf
 </t>
 <t>
leaf-list
 </t>
 <t>
list
 </t>
 <t>
non-presence container (or NP-container)
 </t>
 <t>
ordered-by system
 </t>
 <t>
ordered-by user
 </t>
 <t>
presence container (or P-container)
 </t>
 <t>
RPC operation (now called protocol operation)
 </t>
 </list>
</t>
</section>
<section title="Terms" anchor="terms">
    <t>
The following terms are used within this document:
    </t>
<t>
 <list style="symbols">
 <t>
API resource: a resource with the media type
&quot;application/yang.api+xml&quot; or &quot;application/yang.api+json&quot;.
 </t>
 <t>
data resource: a resource with the media type
&quot;application/yang.data+xml&quot; or &quot;application/yang.data+json&quot;.
Containers, leafs, list entries, anydata and anyxml nodes can be data
resources.
 </t>
 <t>
datastore resource: a resource with the media type
&quot;application/yang.datastore+xml&quot; or
&quot;application/yang.datastore+json&quot;. Represents a datastore.
 </t>
 <t>
edit operation: a RESTCONF operation on a data resource
using either a POST, PUT, PATCH, or DELETE method.
 </t>
 <t>
event stream resource: This resource represents
an SSE (Server-Sent Events) event stream. The content consists of text
using the media type &quot;text/event&#8209;stream&quot;, as defined by the HTML5
specification. Each event represents
one &lt;notification&gt; message generated by the server.
It contains a conceptual system or data-model specific event
that is delivered within an event notification stream.
Also called a &quot;stream resource&quot;.
 </t>
 <t>
media-type: HTTP uses Internet media types <xref target="RFC2046"/> in the Content-Type
and Accept header fields in order to provide open and extensible
data typing and type negotiation.
 </t>
 <t>
operation: the conceptual RESTCONF operation for a message,
derived from the HTTP method, request URI, headers, and message-body.
 </t>
 <t>
operation resource: a resource with the media type
&quot;application/yang.operation+xml&quot; or
&quot;application/yang.operation+json&quot;.
 </t>
 <t>
patch: a generic PATCH request on the target datastore
or data resource.
The media type of the message-body content will identify
the patch type in use.
 </t>
 <t>
plain patch: a specific PATCH request type that can be used
for simple merge operations.
 </t>
 <t>
query parameter: a parameter (and its value if any),
encoded within the query component of the request URI.
 </t>
 <t>
RESTCONF capability: An optional RESTCONF protocol feature
supported by the server, which is identified by an IANA registered
NETCONF Capability URI, and advertised with an entry in
the &quot;capability&quot; leaf-list in <xref target="mon-mod"/>.
 </t>
 <t>
retrieval request: a request using the GET or HEAD methods.
 </t>
 <t>
target resource: the resource that is associated with
a particular message, identified by the &quot;path&quot; component
of the request URI.
 </t>
 <t>
schema resource: a resource with the media type
&quot;application/yang&quot;. The YANG representation of the schema
can be retrieved by the client with the GET method.
 </t>
 <t>
stream list: the set of data resource instances that describe
the event stream resources available from the server.
This information is defined in the &quot;ietf&#8209;restconf&#8209;monitoring&quot;
module as the &quot;stream&quot; list. It can be retrieved using the
target resource &quot;{+restconf}/data/ietf&#8209;restconf&#8209;monitoring:restconf&#8209;state/streams/stream&quot;.
The stream list contains information about each stream,
such as the URL to retrieve the event stream data.
 </t>
 </list>
</t>
</section>
<section title="URI Template" anchor="uri-template">
    <t>
Throughout this document, the URI template <xref target="RFC6570"/> syntax
&quot;{+restconf}&quot; is used to refer to the RESTCONF API entry point outside
of an example.  See <xref target="root-resource-discovery"/> for details.
    </t>
    <t>
For simplicity, all of the examples in this document assume
&quot;/restconf&quot; as the discovered RESTCONF API root path.
    </t>
</section>
<section title="Tree Diagrams" anchor="tree-diagrams">
    <t>
A simplified graphical representation of the data model is used in
this document.  The meaning of the symbols in these
diagrams is as follows:
    </t>
<t>
 <list style="symbols">
 <t>
Brackets &quot;[&quot; and &quot;]&quot; enclose list keys.
 </t>
 <t>
Abbreviations before data node names: &quot;rw&quot; means configuration
data (read-write) and &quot;ro&quot; state data (read-only).
 </t>
 <t>
Symbols after data node names: &quot;?&quot; means an optional node, &quot;!&quot; means
a presence container, and &quot;*&quot; denotes a list and leaf-list.
 </t>
 <t>
Parentheses enclose choice and case nodes, and case nodes are also
marked with a colon (&quot;:&quot;).
 </t>
 <t>
Ellipsis (&quot;...&quot;) stands for contents of subtrees that are not shown.
 </t>
 </list>
</t>
</section>
</section>
</section>
<section title="Transport Protocol Requirements" anchor="transport-protocol-requirements">
<section title="Integrity and Confidentiality" anchor="integrity-and-confidentiality">
    <t>
HTTP <xref target="RFC7230"/> is an application layer protocol that may be layered on
any reliable transport-layer protocol.  RESTCONF is defined on top of
HTTP, but due to the sensitive nature of the information conveyed,
RESTCONF requires that the transport-layer protocol provides both data
integrity and confidentiality, such as are provided by the TLS
protocol <xref target="RFC5246"/>.
    </t>
</section>
<section title="HTTPS with X.509v3 Certificates" anchor="https-with-x509v3-certificates">
    <t>
Given the nearly ubiquitous support for HTTP over TLS <xref target="RFC7230"/>,
RESTCONF implementations MUST support the &quot;https&quot; URI scheme, which
has the IANA assigned default port 443.  Consistent with the exclusive
use of X.509v3 certificates for NETCONF over TLS
<xref target="RFC7589"/>, use of certificates in RESTCONF is
also limited to X.509v3 certificates.
    </t>
</section>
<section title="Certificate Validation" anchor="certificate-validation">
    <t>
When presented an X.509 certificate, the RESTCONF peer MUST use X.509
certificate path validation <xref target="RFC5280"/> to verify the integrity of the
certificate.  The presented X.509 certificate MAY also be considered
valid if it matches a locally configured certificate fingerprint.  If
X.509 certificate path validation fails and the presented X.509
certificate does not match a locally configured certificate
fingerprint, the connection MUST be terminated as defined in
<xref target="RFC5246"/>.
    </t>
</section>
<section title="Authenticated Server Identity" anchor="authenticated-server-identity">
    <t>
The RESTCONF client MUST carefully examine the certificate presented
by the RESTCONF server to determine if it meets the client&apos;s
expectations.  The RESTCONF client MUST check the identity of the
server according to Section 6 of <xref target="RFC6125"/>, including processing the
outcome as described in Section 6.6 of <xref target="RFC6125"/>.
    </t>
</section>
<section title="Authenticated Client Identity" anchor="authenticated-client-identity">
    <t>
The RESTCONF server MUST authenticate client access to any
protected resource.   If the RESTCONF client is not authenticated
to access a resource, the server MUST send an HTTP response with
status code 401 (Unauthorized), as defined in Section 3.1 of
<xref target="RFC7235"/>.
    </t>
    <t>
RESTCONF client authentication MUST either use TLS client
certificates, like NETCONF over TLS <xref target="RFC7589"/>, or use
a standard HTTP Authentication scheme, see Section 5.1
in <xref target="RFC7235"/>.  A combination of both client certificates
and an HTTP Authentication scheme is also allowed, with
the determination of how to process this combination left
as an implementation decision.
    </t>
    <t>
The RESTCONF client identity derived from the authentication
mechanism used is hereafter known as the &quot;RESTCONF username&quot; and
subject to the NETCONF Access Control Module (NACM) <xref target="RFC6536"/>.
For when a client certificate is presented, this identity MUST
be derived using the algorithm defined in Section 7 of <xref target="RFC7589"/>.
For all other cases, when HTTP Authentication is used, the
identity is provided by the HTTP Authentication scheme used.
    </t>
</section>
</section>
<section title="Resources" anchor="resources">
    <t>
The RESTCONF protocol operates on a hierarchy of resources, starting
with the top-level API resource itself
(<xref target="root-resource-discovery"/>). Each resource represents a manageable
component within the device.
    </t>
    <t>
A resource can be considered a collection of conceptual data and the
set of allowed methods on that data.  It can contain nested child
resources.  The child resource types and methods allowed on them are
data-model specific.
    </t>
    <t>
A resource has its own media type identifier, represented
by the &quot;Content&#8209;Type&quot; header in the HTTP response message.
A resource can contain zero or more nested resources.
A resource can be created and deleted independently of its
parent resource, as long as the parent resource exists.
    </t>
    <t>
All RESTCONF resources are defined in this document except
specific datastore contents, protocol operations, and event notifications.
The syntax and semantics for these resource types are
defined in YANG modules.
    </t>
    <t>
The RESTCONF resources are accessed via a set of
URIs defined in this document.
The set of YANG modules supported by the server
will determine the data model specific operations,
top-level data node resources, and event notification messages
supported by the server.
    </t>
    <t>
The RESTCONF protocol does not include a
resource discovery mechanism.  Instead, the definitions
within the YANG modules advertised by the server
are used to construct a predictable operation or data
resource identifier.
    </t>
<section title="Root Resource Discovery" anchor="root-resource-discovery">
    <t>
In line with the best practices defined by <xref target="RFC7320"/>, RESTCONF
enables deployments to specify where the RESTCONF API is located.
When first connecting to a RESTCONF server, a RESTCONF client MUST
determine the root of the RESTCONF API.  The client discovers this
by getting the &quot;/.well&#8209;known/host&#8209;meta&quot; resource (<xref target="RFC6415"/>) and
using the &lt;Link&gt; element containing the &quot;restconf&quot; attribute :
    </t>
	<figure>
	    <artwork><![CDATA[
   Request
   -------
   GET /.well-known/host-meta HTTP/1.1
   Host: example.com
   Accept: application/xrd+xml

   Response
   --------
   HTTP/1.1 200 OK
   Content-Type: application/xrd+xml
   Content-Length: nnn
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
   <XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
       <Link rel='restconf' href='/restconf'/>
   </XRD>
	    ]]></artwork>
	</figure>
    <t>
Once discovering the RESTCONF API root, the client MUST prepend it to
any subsequent request to a RESTCONF resource.  For instance, using
the &quot;/restconf&quot; path discovered above, the client can now determine
the operations supported by the the server.   In this example a
custom &quot;play&quot; operation is supported:
    </t>
	<figure>
	    <artwork><![CDATA[
   Request
   -------
   GET /restconf/operations  HTTP/1.1
   Host: example.com
   Accept: application/yang.api+json

   Response
   --------
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:01:00 GMT
   Server: example-server
   Cache-Control: no-cache
   Pragma: no-cache
   Last-Modified: Sun, 22 Apr 2012 01:00:14 GMT
   Content-Type: application/yang.api+json

   { "operations" : { "example-jukebox:play" : [ null ] } }
	    ]]></artwork>
	</figure>
</section>
<section title="RESTCONF Resource Types" anchor="restconf-resource-types">
    <t>
The RESTCONF protocol defines a set of application specific media
types to identify each of the available resource types.  The following
resource types are defined in RESTCONF:
    </t>
<?rfc compact="yes"?><texttable title="RESTCONF Media Types">
<ttcol align='left'> Resource</ttcol>
<ttcol align='left'>Media Type</ttcol>
<c>API</c>
<c>application/yang.api+xml</c>
<c></c>
<c>application/yang.api+json</c>
<c>Datastore</c>
<c>application/yang.datastore+xml</c>
<c></c>
<c>application/yang.datastore+json</c>
<c>Data</c>
<c>application/yang.data+xml</c>
<c></c>
<c>application/yang.data+json</c>
<c>Errors</c>
<c>application/yang.errors+xml</c>
<c></c>
<c>application/yang.errors+json</c>
<c>Operation</c>
<c>application/yang.operation+xml</c>
<c></c>
<c>application/yang.operation+json</c>
<c>Schema</c>
<c>application/yang</c>
</texttable>
<?rfc compact="no"?></section>
<section title="API Resource" anchor="api-resource">
    <t>
The API resource contains the entry points for
the RESTCONF datastore and operation resources.
It is the top-level resource located at {+restconf} and has the media type
&quot;application/yang.api+xml&quot; or &quot;application/yang.api+json&quot;.
    </t>
    <t>
YANG Tree Diagram for an API Resource:
    </t>
	<figure>
	    <artwork><![CDATA[
   +--rw restconf
      +--rw data
      +--rw operations
	    ]]></artwork>
	</figure>
    <t>
The &quot;application/yang.api&quot; restconf-media-type extension
in the &quot;ietf&#8209;restconf&quot; module
defined in <xref target="module"/> is used to specify the structure and syntax
of the conceptual child resources within the API resource.
    </t>
    <t>
The API resource can be retrieved with the GET method.
    </t>
    <t>
This resource has the following child resources:
    </t>
<?rfc compact="yes"?><texttable title="RESTCONF API Resource">
<ttcol align='left'> Child Resource</ttcol>
<ttcol align='left'>Description</ttcol>
<c>data</c>
<c>Contains all data resources</c>
<c>operations</c>
<c>Data-model specific operations</c>
</texttable>
<?rfc compact="no"?><section title="{+restconf}/data" anchor="restconfdata">
    <t>
This mandatory resource represents the combined configuration
and operational data resources that can be accessed by a client.
It cannot be created or deleted by the client.
The datastore resource type is defined in <xref target="datastore-resource"/>.
    </t>
    <t>
Example:
    </t>
    <t>
This example request by the client
would retrieve only the non-configuration data nodes
that exist within the &quot;library&quot; resource, using the &quot;content&quot;
query parameter (see <xref target="content"/>).
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/example-jukebox:jukebox/library
       ?content=nonconfig  HTTP/1.1
   Host: example.com
   Accept: application/yang.data+xml
	    ]]></artwork>
	</figure>
    <t>
The server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:01:30 GMT
   Server: example-server
   Cache-Control: no-cache
   Pragma: no-cache
   Content-Type: application/yang.data+xml
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
   <library xmlns="https://example.com/ns/example-jukebox">
     <artist-count>42</artist-count>
     <album-count>59</album-count>
     <song-count>374</song-count>
   </library>
	    ]]></artwork>
	</figure>
</section>
<section title="{+restconf}/operations" anchor="restconfoperations">
    <t>
This optional resource is a container that provides access to the
data-model specific protocol operations supported by the server.
The server MAY omit this resource if no data-model specific
operations are advertised.
    </t>
    <t>
Any data-model specific protocol operations defined in the YANG
modules advertised by the server MAY be available as child nodes of
this resource.
    </t>
    <t>
Operation resources are defined in <xref target="operation-resource"/>.
    </t>
</section>
</section>
<section title="Datastore Resource" anchor="datastore-resource">
    <t>
The &quot;{+restconf}/data&quot; subtree represents the datastore resource type,
which is a collection of configuration and operational data nodes.
    </t>
    <t>
This resource type is an abstraction of the system&apos;s underlying datastore
implementation. It is used to simplify resource
editing for the client. The RESTCONF datastore resource is a
conceptual collection of all configuration and operational data
that is present on the device.
    </t>
    <t>
Configuration edit transaction management and configuration persistence
are handled by the server and not controlled by the client.
A datastore resource can only be written directly with
the PATCH method. Each RESTCONF edit of a datastore resource is
saved to non-volatile storage by the server.
    </t>
<section title="Edit Collision Detection" anchor="edit-collision">
    <t>
Two &quot;edit collision detection&quot; mechanisms are provided
in RESTCONF, for datastore and data resources.
    </t>
<section title="Timestamp" anchor="timestamp">
    <t>
The last change time is maintained and
the &quot;Last&#8209;Modified&quot; (<xref target="RFC7232"/>, Section 2.2) header is returned in the
response for a retrieval request.
The &quot;If&#8209;Unmodified&#8209;Since&quot; header can be used
in edit operation requests to cause the server
to reject the request if the resource has been modified
since the specified timestamp.
    </t>
    <t>
The server MUST maintain a last-modified timestamp for the
top-level {+restconf}/data resource and SHOULD maintain
last-modified timestamps for descendant resources.  For all
resources, the server MUST return the &quot;Last&#8209;Modified&quot; header
when the resource is retrieved with the GET or HEAD methods.
If the server does not maintain a timestamp for a resource,
it MUST return the timestamp of the resource&apos;s ancestor, a
process that may recurse up to the top-level {+restconf}/data resource.
Only changes to configuration data resources within
the datastore affect the timestamp.
    </t>
</section>
<section title="Entity tag" anchor="entity-tag">
    <t>
A unique opaque string is maintained and
the &quot;ETag&quot; (<xref target="RFC7232"/>, Section 2.3) header is returned in the
response for a retrieval request.
The &quot;If&#8209;Match&quot; header can be used
in edit operation requests to cause the server
to reject the request if the resource entity tag
does not match the specified value.
    </t>
    <t>
The server MUST maintain an entity tag for the
top-level {+restconf}/data resource and SHOULD maintain
entity tags for descendant resources.  For all
resources, the server MUST return the &quot;ETag&quot; header
when the resource is retrieved with the GET or HEAD methods.
If the server does not maintain an entity tag for a resource,
it MUST return the entity tag of the resource&apos;s ancestor, a
process that may recurse up to the top-level {+restconf}/data resource.
Only changes to configuration data resources within
the datastore affect the entity tag.
    </t>
</section>
</section>
</section>
<section title="Data Resource" anchor="data-resource">
    <t>
A data resource represents a YANG data node that is a descendant
node of a datastore resource.  Each YANG-defined data node can be uniquely
targeted by the request-line of an HTTP operation.  Containers,
leafs, list entries, anydata and anyxml nodes are data resources.
    </t>
    <t>
The representation maintained for each data resource is the YANG
defined subtree for that node.  HTTP operations on a data
resource affect both the targeted data node and all
its descendants, if any.
    </t>
    <t>
For configuration data resources,
the server MAY maintain a last-modified timestamp for the
resource, and return the &quot;Last&#8209;Modified&quot; header when it
is retrieved with the GET or HEAD methods.
If maintained, the resource timestamp MUST be set to the current
time whenever the resource
or any configuration resource within the resource is altered.
    </t>
    <t>
For configuration data resources,
the server MAY maintain a resource entity tag for the
resource, and return the &quot;ETag&quot; header when it
is retrieved as the target resource with the GET or HEAD methods.
If maintained, the resource entity tag MUST be updated
whenever the resource
or any configuration resource within the resource is altered.
    </t>
    <t>
A data resource can be retrieved with the GET method.
Data resources are accessed via the &quot;{+restconf}/data&quot; entry point.
This sub-tree is used to retrieve and edit data resources.
    </t>
    <t>
A configuration data resource can be altered by the client
with some or all of the edit operations, depending on the
target resource and the specific operation. Refer to <xref target="operations"/>
for more details on edit operations.
    </t>
    <t>
The resource definition version for a data resource
is identified by the revision date of the YANG module
containing the YANG definition for the data resource.
    </t>
<section title="Encoding Data Resource Identifiers in the Request URI" anchor="uri-encoding">
    <t>
In YANG, data nodes are named with an absolute
XPath expression, defined in <xref target="XPath"/>, starting
from the document root to the target resource.
In RESTCONF, URL encoded path expressions are used instead.
    </t>
    <t>
A predictable location for a data resource
is important, since applications will code to the YANG
data model module, which uses static naming and defines an
absolute path location for all data nodes.
    </t>
    <t>
A RESTCONF data resource identifier is not an XPath expression.  It is
encoded from left to right, starting with the top-level data node,
according to the &quot;api&#8209;path&quot; rule in <xref target="path-abnf"/>.  The node name of
each ancestor of the target resource node is encoded in order, ending
with the node name for the target resource.  If a node in the path is
defined in another module than its parent node, then module name
followed by a colon character (&quot;:&quot;) is prepended to the node name in
the resource identifier.  See <xref target="path-abnf"/> for details.
    </t>
    <t>
If a data node in the path expression is a YANG list node,
then the key values for the list (if any) MUST be encoded
according to the following rules:
    </t>
<t>
 <list style="symbols">
 <t>
The key leaf values for a data resource representing a YANG
list MUST be encoded using one path segment <xref target="RFC3986"/>.
 </t>
 <t>
If there is only one key leaf value, the path segment is constructed
by having the list name followed by an &quot;=&quot; followed by the single key
leaf value.
 </t>
 <t>
If there are multiple key leaf values, the value of each leaf
identified in the &quot;key&quot; statement is encoded
in the order specified in the YANG &quot;key&quot; statement, with a
comma separating them.
 </t>
 <t>
The key value is specified as a string, using the
canonical representation for the YANG data type.
Any reserved characters MUST be
percent-encoded, according to <xref target="RFC3986"/>, section 2.1.
 </t>
 <t>
All the components in the &quot;key&quot; statement MUST be encoded.
Partial instance identifiers are not supported.
 </t>
 <t>
A missing key value is interpreted a zero-length string.
(example: list=foo,,baz).
 </t>
 <t>
The &quot;list&#8209;instance&quot; ABNF rule defined in <xref target="path-abnf"/>
represents the syntax of a list instance identifier.
 </t>
 <t>
Resource URI values returned in Location headers
for data resources MUST identify the module name, even
if there are no conflicting local names when the resource
is created. This ensures the correct resource will be identified
even if the server loads a new module that the old client
does not know about.
 </t>
 </list>
</t>
    <t>
Examples:
    </t>
	<figure>
	    <artwork><![CDATA[
   container top {
       list list1 {
           key "key1 key2 key3";
            ...
            list list2 {
                key "key4 key5";
                ...
                leaf X { type string; }
            }
        }
    }
	    ]]></artwork>
	</figure>
    <t>
For the above YANG definition, URI with key leaf values will be
encoded as follows (line wrapped for display purposes only):
    </t>
	<figure>
	    <artwork><![CDATA[
    /restconf/data/example-top:top/list1=key1val,key2val,key3val/
       list2=key4val,key5val/X
	    ]]></artwork>
	</figure>
    <t>
The following example shows how reserved characters are
percent-encoded within a key value.  The value of &quot;key1&quot; contains a
comma, single-quote, double-quote, colon, double-quote, space, and
forward slash. (,&apos;&quot;:&quot; /).  Note that double-quote is not a reserved
characters and does not need to be percent-encoded.  The value of
&quot;key2&quot; is the empty string, and the value of &quot;key3&quot; is the string
&quot;foo&quot;.
    </t>
    <t>
Example URL:
    </t>
	<figure>
	    <artwork><![CDATA[
   /restconf/data/example-top:top/list1=%2C%27"%3A"%20%2F,,foo
	    ]]></artwork>
	</figure>
<section title="ABNF For Data Resource Identifiers" anchor="path-abnf">
    <t>
The &quot;api&#8209;path&quot; ABNF syntax is used to construct RESTCONF
path identifiers:
    </t>
	<figure>
	    <artwork><![CDATA[
    api-path = "/"  |
               ("/" api-identifier
                 0*("/" (api-identifier | list-instance )))

    api-identifier = [module-name ":"] identifier   ;; note 1

    module-name = identifier

    list-instance = api-identifier "=" key-value ["," key-value]*

    key-value = string      ;; note 1

    string = <a quoted or unquoted string>

    ;; An identifier MUST NOT start with
    ;; (('X'|'x') ('M'|'m') ('L'|'l'))
    identifier  = (ALPHA / "_")
                  *(ALPHA / DIGIT / "_" / "-" / ".")
	    ]]></artwork>
	</figure>
    <t>
Note 1: The syntax for &quot;api&#8209;identifier&quot; and &quot;key&#8209;value&quot; MUST conform to the
JSON identifier encoding rules in Section 4 of <xref target="I-D.ietf-netmod-yang-json"/>.
    </t>
</section>
</section>
<section title="Defaults Handling" anchor="defaults-handling">
    <t>
RESTCONF requires that a server report its default handling mode
(see <xref target="defaults-uri"/> for details).  If the optional &quot;with&#8209;defaults&quot; query
parameter is supported by the server, a client may use it to control
retrieval of default values  (see <xref target="with-defaults"/> for details).
    </t>
    <t>
If the target of a GET method is a data node
that represents a leaf that has a default value,
and the leaf has not been given a value yet, the server MUST
return the default value that is in use by the server.
    </t>
    <t>
If the target of a GET method is a data node
that represents a container or list that has any child resources
with default values, for the child resources that have not been given
value yet, the server MAY
return the default values that are in use by the server, in accordance
with its reported default handing mode and query parameters passed by the client.
    </t>
</section>
</section>
<section title="Operation Resource" anchor="operation-resource">
    <t>
An operation resource represents a protocol operation
defined with one of the YANG &quot;action&quot; or &quot;rpc&quot; statements.
It is invoked using a POST method on the operation resource.
    </t>
    <t>
An RPC operation is invoked as:
    </t>
	<figure>
	    <artwork><![CDATA[
   POST {+restconf}/operations/<operation>
	    ]]></artwork>
	</figure>
    <t>
The &lt;operation&gt; field identifies the module name and rpc identifier
string for the desired operation.
    </t>
    <t>
For example, if &quot;module&#8209;A&quot; defined a &quot;reset&quot; rpc operation, then
invoking the operation from &quot;module&#8209;A&quot; would be requested as follows:
    </t>
	<figure>
	    <artwork><![CDATA[
   POST /restconf/operations/module-A:reset HTTP/1.1
   Server example.com
	    ]]></artwork>
	</figure>
    <t>
An action is invoked as:
    </t>
	<figure>
	    <artwork><![CDATA[
   POST {+restconf}/data/<data-resource-identifier>/<operation>
	    ]]></artwork>
	</figure>
    <t>
where &lt;data&#8209;resource&#8209;identifier&gt; contains the path to the data node
where the action is defined, and &lt;operation&gt; is the name of the
action.
    </t>
    <t>
For example, if &quot;module&#8209;A&quot; defined a &quot;reset&#8209;all&quot; action in the
container &quot;interfaces&quot;, then invoking this action would be requested
as follows:
    </t>
	<figure>
	    <artwork><![CDATA[
   POST /restconf/data/module-A:interfaces/reset-all HTTP/1.1
   Server example.com
	    ]]></artwork>
	</figure>
    <t>
If the &quot;action&quot; or &quot;rpc&quot; statement has an &quot;input&quot; section, then a
message-body MAY be sent by the client in the request, otherwise the
request message MUST NOT include a message-body.
    </t>
    <t>
If the operation is successfully invoked, and if the &quot;action&quot; or &quot;rpc&quot;
statement has an &quot;output&quot; section, then a message-body MAY be sent by
the server in the response, otherwise the response message MUST NOT
include a message-body in the response message, and MUST send a &quot;204
No Content&quot; status-line instead.
    </t>
    <t>
If the operation is not successfully invoked, then a message-body
SHOULD be sent by the server, containing an &quot;errors&quot; resource,
as defined in <xref target="errors-media-type"/>.
    </t>
<section title="Encoding Operation Input Parameters" anchor="example-ops-mod">
    <t>
If the &quot;action&quot; or &quot;rpc&quot; statement has an &quot;input&quot; section, then
the &quot;input&quot; node is provided in the message-body,
corresponding to the YANG data definition statements
within the &quot;input&quot; section.
    </t>
    <t>
Example:
    </t>
    <t>
The following YANG definition is used for the examples in this
section.
    </t>
	<figure>
	    <artwork><![CDATA[
  module example-ops {
   namespace "https://example.com/ns/example-ops";
   prefix "ops";

    rpc reboot {
      input {
        leaf delay {
          units seconds;
          type uint32;
          default 0;
        }
        leaf message { type string; }
        leaf language { type string; }
      }
    }

    rpc get-reboot-info {
      output {
        leaf reboot-time {
          units seconds;
          type uint32;
        }
        leaf message { type string; }
        leaf language { type string; }
      }
    }
  }
	    ]]></artwork>
	</figure>
    <t>
The client might send the following POST request message:
    </t>
	<figure>
	    <artwork><![CDATA[
   POST /restconf/operations/example-ops:reboot HTTP/1.1
   Host: example.com
   Content-Type: application/yang.operation+xml
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
   <input xmlns="https://example.com/ns/example-ops">
    <delay>600</delay>
    <message>Going down for system maintenance</message>
    <language>en-US</language>
   </input>
	    ]]></artwork>
	</figure>
    <t>
The server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 204 No Content
   Date: Mon, 25 Apr 2012 11:01:00 GMT
   Server: example-server
	    ]]></artwork>
	</figure>
</section>
<section title="Encoding Operation Output Parameters" anchor="encoding-operation-output-parameters">
    <t>
If the &quot;action&quot; or &quot;rpc&quot; statement has an &quot;output&quot; section, then
the &quot;output&quot; node is provided in the message-body,
corresponding to the YANG data definition statements
within the &quot;output&quot; section.
    </t>
    <t>
Example:
    </t>
    <t>
The &quot;example&#8209;ops&quot; YANG module defined in <xref target="example-ops-mod"/>
is used for the examples in this section.
    </t>
    <t>
The client might send the following POST request message:
    </t>
	<figure>
	    <artwork><![CDATA[
   POST /restconf/operations/example-ops:get-reboot-info HTTP/1.1
   Host: example.com
   Accept: application/yang.operation+json
	    ]]></artwork>
	</figure>
    <t>
The server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 25 Apr 2012 11:10:30 GMT
   Server: example-server
   Content-Type: application/yang.operation+json

   {
     "example-ops:output" : {
       "reboot-time" : 30,
       "message" : "Going down for system maintenance",
       "language" : "en-US"
     }
   }
	    ]]></artwork>
	</figure>
</section>
<section title="Encoding Operation Errors" anchor="encoding-operation-errors">
    <t>
If any errors occur while attempting to invoke the operation,
then an &quot;errors&quot; data structure is returned with the
appropriate error status.
    </t>
    <t>
Using the &quot;reset&quot; operation example above,
the client might send the following POST request message:
    </t>
	<figure>
	    <artwork><![CDATA[
   POST /restconf/operations/example-ops:reboot HTTP/1.1
   Host: example.com
   Content-Type: application/yang.operation+xml
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
   <input xmlns="https://example.com/ns/example-ops">
    <delay>-33</delay>
    <message>Going down for system maintenance</message>
    <language>en-US</language>
   </input>
	    ]]></artwork>
	</figure>
    <t>
The server might respond with an &quot;invalid&#8209;value&quot; error:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 400 Bad Request
   Date: Mon, 25 Apr 2012 11:10:30 GMT
   Server: example-server
   Content-Type: application/yang.errors+xml
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
   <errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
    <error>
     <error-type>protocol</error-type>
     <error-tag>invalid-value</error-tag>
     <error-path xmlns:err="https://example.com/ns/example-ops">
       err:input/err:delay
     </error-path>
     <error-message>Invalid input parameter</error-message>
    </error>
   </errors>
	    ]]></artwork>
	</figure>
</section>
</section>
<section title="Schema Resource" anchor="schema-resource">
    <t>
The server can optionally support retrieval of the YANG modules it
supports, using the &quot;ietf&#8209;yang&#8209;library&quot; module,
defined in <xref target="I-D.ietf-netconf-yang-library"/>.
    </t>
    <t>
To retrieve a YANG module, a client first needs to get
the URL for retrieving the schema.
    </t>
    <t>
The client might send the following GET request message:
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/ietf-yang-library:modules/module=
       example-jukebox,2014-07-03/schema HTTP/1.1
   Host: example.com
   Accept: application/yang.data+json
	    ]]></artwork>
	</figure>
    <t>
The server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 25 Apr 2012 11:10:30 GMT
   Server: example-server
   Content-Type: application/yang.data+json

   {
     "ietf-yang-library:schema":
      "https://example.com/mymodules/example-jukebox/2015-06-04"
   }
	    ]]></artwork>
	</figure>
    <t>
Next the client needs to retrieve the actual YANG schema.
    </t>
    <t>
The client might send the following GET request message:
    </t>
	<figure>
	    <artwork><![CDATA[
   GET https://example.com/mymodules/example-jukebox/2015-06-04
      HTTP/1.1
   Host: example.com
   Accept: application/yang
	    ]]></artwork>
	</figure>
    <t>
The server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   module example-jukebox {

      // contents of YANG module deleted for this example...

   }
	    ]]></artwork>
	</figure>
</section>
<section title="Event Stream Resource" anchor="stream-resource">
    <t>
An &quot;event stream&quot; resource represents a source for system generated
event notifications.  Each stream is created and modified
by the server only.  A client can retrieve a stream resource
or initiate a long-poll server sent event stream,
using the procedure specified in <xref target="receive-notifs"/>.
    </t>
    <t>
A notification stream functions according to the NETCONF
Notifications specification <xref target="RFC5277"/>. The available streams
can be retrieved from the stream list,
which specifies the syntax and semantics of a stream resource.
    </t>
</section>
<section title="Errors Media Type" anchor="errors-media-type">
    <t>
An &quot;errors&quot; media type is a collection of error information that
is sent as the message-body in a server response message,
if an error occurs while processing a request message.
It is not considered a resource type because no instances
can be retrieved with a GET request.
    </t>
    <t>
The &quot;ietf&#8209;restconf&quot; YANG module contains the &quot;application/yang.errors&quot;
restconf-media-type extension which specifies the syntax and
semantics of an &quot;errors&quot; media type.
RESTCONF error handling behavior is defined in <xref target="error-reporting"/>.
    </t>
</section>
</section>
<section title="Operations" anchor="operations">
    <t>
The RESTCONF protocol uses HTTP methods to identify
the CRUD operation requested for a particular resource.
    </t>
    <t>
The following table shows how the RESTCONF operations relate to
NETCONF protocol operations:
    </t>
<?rfc compact="yes"?><texttable anchor="table-crud-operations" title="CRUD Methods in RESTCONF">
<ttcol align='left'> RESTCONF</ttcol>
<ttcol align='left'>NETCONF</ttcol>
<c>OPTIONS</c>
<c>none</c>
<c>HEAD</c>
<c>none</c>
<c>GET</c>
<c>&lt;get-config&gt;, &lt;get&gt;</c>
<c>POST</c>
<c>&lt;edit-config&gt; (operation=&quot;create&quot;)</c>
<c>PUT</c>
<c>&lt;edit-config&gt; (operation=&quot;create/replace&quot;)</c>
<c>PATCH</c>
<c>&lt;edit-config&gt; (operation=&quot;merge&quot;)</c>
<c>DELETE</c>
<c>&lt;edit-config&gt; (operation=&quot;delete&quot;)</c>
</texttable>
<?rfc compact="no"?>    <t>
The NETCONF &quot;remove&quot; operation attribute is not supported
by the HTTP DELETE method. The resource must exist or
the DELETE method will fail. The PATCH method is equivalent to
a &quot;merge&quot; operation when using a plain patch (see <xref target="plain-patch"/>),
other media-types may provide more granular control.
    </t>
    <t>
Access control mechanisms may be used to limit what operations
can be used.  In particular, RESTCONF is compatible with the
NETCONF Access Control Model (NACM) <xref target="RFC6536"/>, as there is a
specific mapping between RESTCONF and NETCONF operations,
defined in <xref target="table-crud-operations"/>.  The resource path needs
to be converted internally by the server to the corresponding
YANG instance-identifier.  Using this information,
the server can apply the NACM access control rules to RESTCONF
messages.
    </t>
    <t>
The server MUST NOT allow any operation to any resources that
the client is not authorized to access.
    </t>
    <t>
Implementation of all methods (except PATCH) are defined in <xref target="RFC7231"/>.
This section defines the RESTCONF protocol usage for
each HTTP method.
    </t>
<section title="OPTIONS" anchor="options">
    <t>
The OPTIONS method is sent by the client to
discover which methods are supported by the server
for a specific resource (e.g., GET, POST, DELETE, etc.).
    </t>
    <t>
The server SHOULD implement this method, however the same information
could be extracted from the YANG modules and the RESTCONF
protocol specification.
    </t>
    <t>
If the PATCH method is supported, then the &quot;Accept&#8209;Patch&quot; header MUST
be supported and returned in the response to the OPTIONS request, as
defined in <xref target="RFC5789"/>.
    </t>
</section>
<section title="HEAD" anchor="head">
    <t>
The HEAD method is sent by the client to
retrieve just the headers that would be returned
for the comparable GET method, without the response message-body.
It is supported for all resource types, except operation resources.
    </t>
    <t>
The request MUST contain a request URI
that contains at least the entry point.
The same query parameters supported by the GET method
are supported by the HEAD method.
    </t>
    <t>
The access control behavior is enforced
as if the method was GET instead of HEAD.
The server MUST respond the same as if the method
was GET instead of HEAD, except that no
response message-body is included.
    </t>
</section>
<section title="GET" anchor="get">
    <t>
The GET method is sent by the client to
retrieve data and meta-data for a resource.
It is supported for all resource types, except operation resources.
The request MUST contain a request URI
that contains at least the entry point.
    </t>
    <t>
The server MUST NOT return any data resources for which the user
does not have read privileges.
If the user is not authorized to read
the target resource, an error response containing
a &quot;403 Forbidden&quot; or &quot;404 Not Found&quot; status-line is returned to
the client.
    </t>
    <t>
If the user is authorized to read some but not all of
the target resource, the unauthorized content is omitted
from the response message-body, and the authorized content
is returned to the client.
    </t>
    <t>
Example:
    </t>
    <t>
The client might request the response headers for an
XML representation of the a specific &quot;album&quot; resource:
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/example-jukebox:jukebox/
      library/artist=Foo%20Fighters/album=Wasting%20Light  HTTP/1.1
   Host: example.com
   Accept: application/yang.data+xml
	    ]]></artwork>
	</figure>
    <t>
The server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:02:40 GMT
   Server: example-server
   Content-Type: application/yang.data+xml
   Cache-Control: no-cache
   Pragma: no-cache
   ETag: a74eefc993a2b
   Last-Modified: Mon, 23 Apr 2012 11:02:14 GMT
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
   <album xmlns="http://example.com/ns/example-jukebox">
    <name>Wasting Light</name>
    <genre xmlns:g="http://example.com/ns/example-jukebox">
      g:alternative
    </genre>
    <year>2011</2011>
   </album>
	    ]]></artwork>
	</figure>
</section>
<section title="POST" anchor="post">
    <t>
The POST method is sent by the client to create a data resource
or invoke an operation resource.
The server uses the target resource media type
to determine how to process the request.
    </t>
<?rfc compact="yes"?><texttable title="Resource Types that Support POST">
<ttcol align='left'> Type</ttcol>
<ttcol align='left'>Description</ttcol>
<c>Datastore</c>
<c>Create a top-level configuration data resource</c>
<c>Data</c>
<c>Create a configuration data child resource</c>
<c>Operation</c>
<c>Invoke a protocol operation</c>
</texttable>
<?rfc compact="no"?><section title="Create Resource Mode" anchor="create-resource-mode">
    <t>
If the target resource type is a datastore or data resource, then the
POST is treated as a request to create a top-level resource or child
resource, respectively.  The message-body is expected to contain the
content of a child resource to create within the parent (target
resource).  The data-model for the child tree is the subtree is
defined by YANG for the child resource.
    </t>
    <t>
The &quot;insert&quot; and &quot;point&quot; query parameters are supported
by the POST method for datastore and data resource types,
as specified in the YANG definition in <xref target="module"/>.
    </t>
    <t>
If the POST method succeeds,
a &quot;201 Created&quot; status-line is returned and there is
no response message-body.  A &quot;Location&quot; header identifying
the child resource that was created MUST be present
in the response in this case.
    </t>
    <t>
If the user is not authorized to create the target resource,
an error response containing
a &quot;403 Forbidden&quot; or &quot;404 Not Found&quot; status-line is returned to
the client.  All other error responses are handled according to
the procedures defined in <xref target="error-reporting"/>.
    </t>
    <t>
Example:
    </t>
    <t>
To create a new &quot;jukebox&quot; resource, the client might send:
    </t>
	<figure>
	    <artwork><![CDATA[
   POST /restconf/data HTTP/1.1
   Host: example.com
   Content-Type: application/yang.data+json

   { "example-jukebox:jukebox" : [null] }
	    ]]></artwork>
	</figure>
    <t>
If the resource is created, the server might respond as follows.  Note
that the &quot;Location&quot; header line is wrapped for display purposes only:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 201 Created
   Date: Mon, 23 Apr 2012 17:01:00 GMT
   Server: example-server
   Location: https://example.com/restconf/data/
       example-jukebox:jukebox
   Last-Modified: Mon, 23 Apr 2012 17:01:00 GMT
   ETag: b3a3e673be2
	    ]]></artwork>
	</figure>
    <t>
Refer to <xref target="ex-create"/> for more resource creation examples.
    </t>
</section>
<section title="Invoke Operation Mode" anchor="invoke-operation-mode">
    <t>
If the target resource type is an operation resource,
then the POST method is treated as a request to invoke that operation.
The message-body (if any) is processed as the operation input
parameters.  Refer to <xref target="operation-resource"/> for details
on operation resources.
    </t>
    <t>
If the POST request succeeds, a &quot;200 OK&quot; status-line
is returned if there is a response message-body, and
a &quot;204 No Content&quot; status-line is returned if there is
no response message-body.
    </t>
    <t>
If the user is not authorized to invoke the target operation,
an error response containing
a &quot;403 Forbidden&quot; or &quot;404 Not Found&quot; status-line is returned to
the client.  All other error responses are handled according to
the procedures defined in <xref target="error-reporting"/>.
    </t>
    <t>
Example:
    </t>
    <t>
In this example, the client is invoking the &quot;play&quot; operation
defined in the &quot;example&#8209;jukebox&quot; YANG module.
    </t>
    <t>
A client might send a &quot;play&quot; request as follows:
    </t>
	<figure>
	    <artwork><![CDATA[
   POST /restconf/operations/example-jukebox:play   HTTP/1.1
   Host: example.com
   Content-Type: application/yang.operation+json

   {
     "example-jukebox:input" : {
       "playlist" : "Foo-One",
       "song-number" : 2
     }
   }
	    ]]></artwork>
	</figure>
    <t>
The server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 204 No Content
   Date: Mon, 23 Apr 2012 17:50:00 GMT
   Server: example-server
	    ]]></artwork>
	</figure>
</section>
</section>
<section title="PUT" anchor="put">
    <t>
The PUT method is sent by the client to create or replace
the target resource.
    </t>
    <t>
The only target resource media type that supports PUT is the data
resource. The message-body is expected to contain the
content used to create or replace the target resource.
    </t>
    <t>
The &quot;insert&quot; (<xref target="insert"/>) and &quot;point&quot; (<xref target="point"/>) query parameters are
supported by the PUT method for data resources.
    </t>
    <t>
Consistent with <xref target="RFC7231"/>, if the PUT request creates a new resource,
a &quot;201 Created&quot; status-line is returned.   If an existing resource
is modified, either &quot;200 OK&quot; or &quot;204 No Content&quot; are returned.
    </t>
    <t>
If the user is not authorized to create or replace the target resource
an error response containing
a &quot;403 Forbidden&quot; or &quot;404 Not Found&quot; status-line is returned to
the client.  All other error responses are handled according to
the procedures defined in <xref target="error-reporting"/>.
    </t>
    <t>
Example:
    </t>
    <t>
An &quot;album&quot; child resource defined in the &quot;example&#8209;jukebox&quot; YANG module
is replaced or created if it does not already exist.
    </t>
    <t>
To replace the &quot;album&quot; resource contents,
the client might send as follows.
Note that the request-line is wrapped
for display purposes only:
    </t>
	<figure>
	    <artwork><![CDATA[
   PUT /restconf/data/example-jukebox:jukebox/
       library/artist=Foo%20Fighters/album=Wasting%20Light   HTTP/1.1
   Host: example.com
   Content-Type: application/yang.data+json

   {
     "example-jukebox:album" : {
       "name" : "Wasting Light",
       "genre" : "example-jukebox:alternative",
       "year" : 2011
     }
   }
	    ]]></artwork>
	</figure>
    <t>
If the resource is updated, the server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 204 No Content
   Date: Mon, 23 Apr 2012 17:04:00 GMT
   Server: example-server
   Last-Modified: Mon, 23 Apr 2012 17:04:00 GMT
   ETag: b27480aeda4c
	    ]]></artwork>
	</figure>
</section>
<section title="PATCH" anchor="patch">
    <t>
RESTCONF uses the HTTP PATCH method defined
in <xref target="RFC5789"/> to provide an extensible framework for
resource patching mechanisms.  It is optional to implement
by the server.  Each patch type needs a unique
media type.  Zero or more PATCH media types MAY be supported
by the server.  The media types supported by a server can be
discovered by the client by sending an OPTIONS request (see
<xref target="options"/>).
    </t>
    <t>
If the target resource instance does not exist, the server MUST NOT
create it.
    </t>
    <t>
If the PATCH request succeeds, a &quot;200 OK&quot; status-line
is returned if there is a message-body, and &quot;204 No Content&quot;
is returned if no response message-body is sent.
    </t>
    <t>
If the user is not authorized to alter the target resource
an error response containing
a &quot;403 Forbidden&quot; or &quot;404 Not Found&quot; status-line is returned to
the client.  All other error responses are handled according to
the procedures defined in <xref target="error-reporting"/>.
    </t>
<section title="Plain Patch" anchor="plain-patch">
    <t>
The plain patch mechanism merges the contents of the message body with
the target resource.  If the target resource is a datastore resource
(see <xref target="datastore-resource"/>), the message body MUST be either
application/yang.datastore+xml or application/yang.datastore+json.  If
then the target resource is a data resource (see <xref target="data-resource"/>),
then the message body MUST be either application/yang.data+xml or
application/yang.data+json.
    </t>
    <t>
Plain patch can used to create or update, but not delete, a child
resource within the target resource.  Please see
<xref target="I-D.ietf-netconf-yang-patch"/> for an alternate media-type supporting
more granular control. The YANG Patch Media Type allows multiple
sub-operations (e.g., merge, delete) within a single PATCH
operation.
    </t>
    <t>
Example:
    </t>
    <t>
To replace just the &quot;year&quot; field in the &quot;album&quot; resource
(instead of replacing the entire resource with the PUT method),
the client might send a plain patch as follows.
Note that the request-line is wrapped
for display purposes only:
    </t>
	<figure>
	    <artwork><![CDATA[
   PATCH /restconf/data/example-jukebox:jukebox/
       library/artist=Foo%20Fighters/album=Wasting%20Light HTTP/1.1
   Host: example.com
   If-Match: b8389233a4c
   Content-Type: application/yang.data+xml
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
   <album xmlns="http://example.com/ns/example-jukebox">
    <year>2011</year>
   </album>
	    ]]></artwork>
	</figure>
    <t>
If the field is updated, the server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 204 No Content
   Date: Mon, 23 Apr 2012 17:49:30 GMT
   Server: example-server
   Last-Modified: Mon, 23 Apr 2012 17:49:30 GMT
   ETag: b2788923da4c
	    ]]></artwork>
	</figure>
</section>
</section>
<section title="DELETE" anchor="delete">
    <t>
The DELETE method is used to delete the target resource.
If the DELETE request succeeds, a &quot;204 No Content&quot; status-line
is returned, and there is no response message-body.
    </t>
    <t>
If the user is not authorized to delete the target resource then
an error response containing
a &quot;403 Forbidden&quot; or &quot;404 Not Found&quot; status-line is returned to
the client.  All other error responses are handled according to
the procedures defined in <xref target="error-reporting"/>.
    </t>
    <t>
Example:
    </t>
    <t>
To delete a resource such as the &quot;album&quot; resource,
the client might send:
    </t>
	<figure>
	    <artwork><![CDATA[
   DELETE /restconf/data/example-jukebox:jukebox/
       library/artist=Foo%20Fighters/album=Wasting%20Light HTTP/1.1
   Host: example.com
	    ]]></artwork>
	</figure>
    <t>
If the resource is deleted, the server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 204 No Content
   Date: Mon, 23 Apr 2012 17:49:40 GMT
   Server: example-server
	    ]]></artwork>
	</figure>
</section>
<section title="Query Parameters" anchor="query-parameters">
    <t>
Each RESTCONF operation allows zero or more query
parameters to be present in the request URI.
The specific parameters that are allowed depends
on the resource type, and sometimes the specific target
resource used, in the request.
    </t>
<?rfc compact="yes"?><texttable title="RESTCONF Query Parameters">
<ttcol align='left'> Name</ttcol>
<ttcol align='left'>Methods</ttcol>
<ttcol align='left'>Description</ttcol>
<c>content</c>
<c>GET</c>
<c>Select config and/or non-config data resources</c>
<c>depth</c>
<c>GET</c>
<c>Request limited sub-tree depth in the reply content</c>
<c>fields</c>
<c>GET</c>
<c>Request a subset of the target resource contents</c>
<c>filter</c>
<c>GET</c>
<c>Boolean notification filter for event stream resources</c>
<c>insert</c>
<c>POST, PUT</c>
<c>Insertion mode for user-ordered data resources</c>
<c>point</c>
<c>POST, PUT</c>
<c>Insertion point for user-ordered data resources</c>
<c>start-time</c>
<c>GET</c>
<c>Replay buffer start time for event stream resources</c>
<c>stop-time</c>
<c>GET</c>
<c>Replay buffer stop time for event stream resources</c>
<c>with-defaults</c>
<c>GET</c>
<c>Control retrieval of default values</c>
</texttable>
<?rfc compact="no"?>    <t>
Query parameters can be given in any order.
Each parameter can appear at most once in a request URI.
A default value may apply if the parameter is missing.
    </t>
    <t>
Refer to <xref target="ex-query"/> for examples of query parameter usage.
    </t>
    <t>
If vendors define additional query parameters, they SHOULD use a
prefix (such as the enterprise or organization name) for query
parameter names in order to avoid collisions with other parameters.
    </t>
<section title="The &quot;content&quot; Query Parameter" anchor="content">
    <t>
The &quot;content&quot; parameter controls how descendant nodes of
the requested data nodes will be processed in the reply.
    </t>
    <t>
The allowed values are:
    </t>
<?rfc compact="yes"?>
<texttable>
<ttcol align='left'>Value</ttcol>
<ttcol align='left'>Description</ttcol>
<c>config</c>
<c>Return only configuration descendant data nodes</c>
<c>nonconfig</c>
<c>Return only non-configuration descendant data nodes</c>
<c>all</c>
<c>Return all descendant data nodes</c>
</texttable>
<?rfc compact="no"?>
    <t>
This parameter is only allowed for GET methods on datastore and data
resources.  A 400 Bad Request error is returned if used for other
methods or resource types.
    </t>
    <t>
The default value is determined by the &quot;config&quot; statement value of the
requested data nodes.  If the &quot;config&quot; value is &quot;false&quot;, then the
default for the &quot;content&quot; parameter is &quot;nonconfig&quot;.  If &quot;config&quot; is
&quot;true&quot; then the default for the &quot;content&quot; parameter is &quot;config&quot;.
    </t>
    <t>
This query parameter MUST be supported by the server.
    </t>
</section>
<section title="The &quot;depth&quot; Query Parameter" anchor="depth">
    <t>
The &quot;depth&quot; parameter is used to specify the number of nest levels
returned in a response for a GET method.  The first nest-level
consists of the requested data node itself.  If the &quot;fields&quot; parameter
(<xref target="fields"/>) is used to select descendant data nodes, these nodes all
have a depth value of 1.  Any child nodes which are contained within a
parent node have a depth value that is 1 greater than its parent.
    </t>
    <t>
The value of the &quot;depth&quot; parameter is either an integer between 1 and
65535, or the string &quot;unbounded&quot;.  &quot;unbounded&quot; is the default.
    </t>
    <t>
This parameter is only allowed for GET methods on API, datastore, and
data resources.  A 400 Bad Request error is returned if it used for
other methods or resource types.
    </t>
    <t>
By default, the server will include all sub-resources within a
retrieved resource, which have the same resource type as the requested
resource.  Only one level of sub-resources with a different media type
than the target resource will be returned.
    </t>
    <t>
If the &quot;depth&quot; query parameter URI is listed in
the &quot;capability&quot; leaf-list in <xref target="mon-mod"/>, then the server
supports the &quot;depth&quot; query parameter.
    </t>
</section>
<section title="The &quot;fields&quot; Query Parameter" anchor="fields">
    <t>
The &quot;fields&quot; query parameter is used to optionally identify
data nodes within the target resource to be retrieved in a
GET method.  The client can use this parameter to retrieve
a subset of all nodes in a resource.
    </t>
    <t>
A value of the &quot;fields&quot; query parameter matches the
following rule:
    </t>
	<figure>
	    <artwork><![CDATA[
  fields-expr = path '(' fields-expr ')' /
                path ';' fields-expr /
                path
  path = api-identifier [ '/' path ]
	    ]]></artwork>
	</figure>
    <t>
&quot;api&#8209;identifier&quot; is defined in <xref target="path-abnf"/>.
    </t>
    <t>
&quot;;&quot; is used to select multiple nodes.  For example, to
retrieve only the &quot;genre&quot; and &quot;year&quot; of an album, use:
&quot;fields=genre;year&quot;.
    </t>
    <t>
Parentheses are used to specify sub-selectors of a node.
    </t>
    <t>
For example, assume the target resource is the &quot;album&quot; list.
To retrieve only the &quot;label&quot; and
&quot;catalogue&#8209;number&quot; of the &quot;admin&quot; container within an album, use:
&quot;fields=admin(label;catalogue&#8209;number)&quot;.
    </t>
    <t>
&quot;/&quot; is used in a path to retrieve a child node of a node.
For example, to retrieve only the &quot;label&quot; of an album, use:
&quot;fields=admin/label&quot;.
    </t>
    <t>
This parameter is only allowed for GET methods on api,
datastore, and data resources.  A 400 Bad Request error
is returned if used for other methods or resource types.
    </t>
    <t>
If the &quot;fields&quot; query parameter URI is listed in the
&quot;capability&quot; leaf-list in <xref target="mon-mod"/>, then the server
supports the &quot;fields&quot; parameter.
    </t>
</section>
<section title="The &quot;insert&quot; Query Parameter" anchor="insert">
    <t>
The &quot;insert&quot; parameter is used to specify how a
resource should be inserted within a user-ordered list.
    </t>
    <t>
The allowed values are:
    </t>
<?rfc compact="yes"?>
<texttable>
<ttcol align='left'>Value</ttcol>
<ttcol align='left'>Description</ttcol>
<c>first</c>
<c>Insert the new data as the new first entry.</c>
<c>last</c>
<c>Insert the new data as the new last entry.</c>
<c>before</c>
<c>Insert the new data before the insertion point, as specified by the value of the &quot;point&quot; parameter.</c>
<c>after</c>
<c>Insert the new data after the insertion point, as specified by the value of the &quot;point&quot; parameter.</c>
</texttable>
<?rfc compact="no"?>
    <t>
The default value is &quot;last&quot;.
    </t>
    <t>
This parameter is only supported for the POST and PUT
methods. It is also only supported if the target
resource is a data resource, and that data represents
a YANG list or leaf-list that is ordered by the user.
    </t>
    <t>
If the values &quot;before&quot; or &quot;after&quot; are used,
then a &quot;point&quot; query parameter for the insertion
parameter MUST also be present, or a 400 Bad Request
error is returned.
    </t>
    <t>
The &quot;insert&quot; query parameter MUST be supported by the server.
    </t>
</section>
<section title="The &quot;point&quot; Query Parameter" anchor="point">
    <t>
The &quot;point&quot; parameter is used to specify the
insertion point for a data resource that is being
created or moved within a user ordered list or leaf-list.
    </t>
    <t>
The value of the &quot;point&quot; parameter is a string that identifies
the path to the insertion point object.  The format is
the same as a target resource URI string.
    </t>
    <t>
This parameter is only supported for the POST and PUT
methods. It is also only supported if the target
resource is a data resource, and that data represents
a YANG list or leaf-list that is ordered by the user.
    </t>
    <t>
If the &quot;insert&quot; query parameter is not present, or has
a value other than &quot;before&quot; or &quot;after&quot;, then a 400
Bad Request error is returned.
    </t>
    <t>
This parameter contains the instance identifier of the
resource to be used as the insertion point for a
POST or PUT method.
    </t>
    <t>
The &quot;point&quot; query parameter MUST be supported by the server.
    </t>
</section>
<section title="The &quot;filter&quot; Query Parameter" anchor="filter">
    <t>
The &quot;filter&quot; parameter is used to indicate which subset of
all possible events are of interest.  If not present, all
events not precluded by other parameters will be sent.
    </t>
    <t>
This parameter is only allowed for GET methods on a
text/event-stream data resource.  A 400 Bad Request error
is returned if used for other methods or resource types.
    </t>
    <t>
The format of this parameter is an XPath 1.0 expression, and is
evaluated in the following context:
    </t>
<t>
 <list style="symbols">
 <t>
The set of namespace declarations is the set of
prefix and namespace pairs for all supported YANG
modules, where the prefix is the YANG module name, and
the namespace is as defined by the &quot;namespace&quot; statement
in the YANG module.
 </t>
 <t>
The function library is the core function library defined
in XPath 1.0.
 </t>
 <t>
The set of variable bindings is empty.
 </t>
 <t>
The context node is the root node.
 </t>
 </list>
</t>
    <t>
The filter is used as defined in <xref target="RFC5277"/>, Section 3.6.
If the boolean result of the expression is true when applied
to the conceptual &quot;notification&quot; document root, then the
event notification is delivered to the client.
    </t>
    <t>
If the &quot;filter&quot; query parameter URI is listed in the &quot;capability&quot; leaf-list
in <xref target="mon-mod"/>, then the server supports the &quot;filter&quot; query parameter.
    </t>
</section>
<section title="The &quot;start&#8209;time&quot; Query Parameter" anchor="start-time">
    <t>
The &quot;start&#8209;time&quot; parameter is used to trigger
the notification replay feature and indicate
that the replay should start at the time specified.
If the stream does not support replay, per the
&quot;replay&#8209;support&quot; attribute returned by stream list
entry for the stream resource, then the server MUST
return the HTTP error code 400 Bad Request.
    </t>
    <t>
The value of the &quot;start&#8209;time&quot; parameter is of type
&quot;date&#8209;and&#8209;time&quot;, defined in the &quot;ietf&#8209;yang&quot; YANG module
<xref target="RFC6991"/>.
    </t>
    <t>
This parameter is only allowed for GET methods on a
text/event-stream data resource.  A 400 Bad Request error
is returned if used for other methods or resource types.
    </t>
    <t>
If this parameter is not present, then a replay subscription
is not being requested.  It is not valid to specify start
times that are later than the current time.  If the value
specified is earlier than the log can support, the replay
will begin with the earliest available notification.
    </t>
    <t>
If this query parameter is supported by the server, then the
&quot;replay&quot; query parameter URI MUST be listed in the &quot;capability&quot; leaf-list
in <xref target="mon-mod"/>. The &quot;stop&#8209;time&quot; query parameter MUST also be supported
by the server.
    </t>
    <t>
If the &quot;replay&#8209;support&quot; leaf is present in the &quot;stream&quot;
entry (defined in <xref target="mon-mod"/>) then the server MUST support
the &quot;start&#8209;time&quot; and &quot;stop&#8209;time&quot; query parameters for that stream.
    </t>
</section>
<section title="The &quot;stop&#8209;time&quot; Query Parameter" anchor="stop-time">
    <t>
The &quot;stop&#8209;time&quot; parameter is used with the
replay feature to indicate the newest notifications of
interest.  This parameter MUST be used with and have a
value later than the &quot;start&#8209;time&quot; parameter.
    </t>
    <t>
The value of the &quot;stop&#8209;time&quot; parameter is of type
&quot;date&#8209;and&#8209;time&quot;, defined in the &quot;ietf&#8209;yang&quot; YANG module
<xref target="RFC6991"/>.
    </t>
    <t>
This parameter is only allowed for GET methods on a
text/event-stream data resource.  A 400 Bad Request error
is returned if used for other methods or resource types.
    </t>
    <t>
If this parameter is not present, the notifications will
continue until the subscription is terminated.
Values in the future are valid.
    </t>
    <t>
If this query parameter is supported by the server, then the
&quot;replay&quot; query parameter URI MUST be listed in the &quot;capability&quot; leaf-list
in <xref target="mon-mod"/>. The &quot;start&#8209;time&quot; query parameter MUST also be supported
by the server.
    </t>
    <t>
If the &quot;replay&#8209;support&quot; leaf is present in the &quot;stream&quot;
entry (defined in <xref target="mon-mod"/>) then the server MUST support
the &quot;start&#8209;time&quot; and &quot;stop&#8209;time&quot; query parameters for that stream.
    </t>
</section>
<section title="The &quot;with&#8209;defaults&quot; Query Parameter" anchor="with-defaults">
    <t>
The &quot;with&#8209;defaults&quot; parameter is used to specify how
information about default data nodes should be returned
in response to GET requests on data resources.
    </t>
    <t>
If the server supports this capability, then it MUST implement
the behavior in Section 4.5.1 of <xref target="RFC6243"/>, except applied to
the RESTCONF GET operation, instead of the NETCONF operations.
    </t>
<?rfc compact="yes"?>
<texttable>
<ttcol align='left'>Value</ttcol>
<ttcol align='left'>Description</ttcol>
<c>report-all</c>
<c>All data nodes are reported</c>
<c>trim</c>
<c>Data nodes set to the YANG default are not reported</c>
<c>explicit</c>
<c>Data nodes set by the client are not reported</c>
<c>report-all-tagged</c>
<c>All data nodes are reported and defaults are tagged</c>
</texttable>
<?rfc compact="no"?>
    <t>
If the &quot;with&#8209;defaults&quot; parameter is set to &quot;report&#8209;all&quot; then the server MUST
adhere to the defaults reporting behavior defined in
Section 3.1 of <xref target="RFC6243"/>.
    </t>
    <t>
If the &quot;with&#8209;defaults&quot; parameter is set to &quot;trim&quot; then the server MUST
adhere to the defaults reporting behavior defined in
Section 3.2 of <xref target="RFC6243"/>.
    </t>
    <t>
If the &quot;with&#8209;defaults&quot; parameter is set to &quot;explicit&quot; then the server MUST
adhere to the defaults reporting behavior defined in
Section 3.3 of <xref target="RFC6243"/>.
    </t>
    <t>
If the &quot;with&#8209;defaults&quot; parameter is set to &quot;report&#8209;all&#8209;tagged&quot;
then the server MUST adhere to the defaults reporting behavior defined in
Section 3.4 of <xref target="RFC6243"/>.
    </t>
    <t>
If the &quot;with&#8209;defaults&quot; parameter is not present
then the server MUST adhere to the defaults reporting behavior defined in
its &quot;basic&#8209;mode&quot; parameter for the &quot;defaults&quot; protocol capability URI,
defined in <xref target="defaults-uri"/>.
    </t>
    <t>
If the server includes the &quot;with&#8209;defaults&quot; query parameter URI in
the &quot;capability&quot; leaf-list in <xref target="mon-mod"/>, then the &quot;with&#8209;defaults&quot;
query parameter MUST be supported.
    </t>
</section>
</section>
</section>
<section title="Messages" anchor="messages">
    <t>
The RESTCONF protocol uses HTTP entities for messages.
A single HTTP message corresponds to a single protocol method.
Most messages can perform a single task on a single resource,
such as retrieving a resource or editing a resource.
The exception is the PATCH method, which allows multiple datastore
edits within a single message.
    </t>
<section title="Request URI Structure" anchor="request-uri-structure">
    <t>
Resources are represented with URIs following the structure
for generic URIs in <xref target="RFC3986"/>.
    </t>
    <t>
A RESTCONF operation is derived from the HTTP method
and the request URI, using the following conceptual fields:
    </t>
	<figure>
	    <artwork><![CDATA[
     <OP> /<restconf>/<path>?<query>#<fragment>
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
      ^       ^        ^       ^         ^
      |       |        |       |         |
    method  entry  resource  query    fragment

      M       M        O        O         I

    M=mandatory, O=optional, I=ignored
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
    <text> replaced by client with real values
	    ]]></artwork>
	</figure>
<t>
 <list style="symbols">
 <t>
method: the HTTP method identifying the RESTCONF operation
requested by the client, to act upon the target resource
specified in the request URI.  RESTCONF operation details are
described in <xref target="operations"/>.
 </t>
 <t>
entry: the root of the RESTCONF API configured on this HTTP
server, discovered by getting the &quot;.well&#8209;known/host&#8209;meta&quot;
resource, as described in <xref target="root-resource-discovery"/>.
 </t>
 <t>
resource: the path expression identifying the resource
that is being accessed by the operation.
If this field is not present, then the target resource
is the API itself, represented by the media type &quot;application/yang.api&quot;.
 </t>
 <t>
query: the set of parameters associated with the RESTCONF
message. These have the familiar form of &quot;name=value&quot; pairs.
Most query parameters are optional to implement by the server
and optional to use by the client. Each optional query parameter is
identified by a URI. The server MUST list the
optional query parameter URIs it supports in the &quot;capabilities&quot;
list defined in <xref target="mon-mod"/>.
 </t>
 </list>
</t>
    <t>
There is a specific set of parameters defined,
although the server MAY choose to support query
parameters not defined in this document.
The contents of the any query parameter value MUST be encoded
according to <xref target="RFC3986"/>, Section 3.4. Any reserved characters
MUST be percent-encoded, according to <xref target="RFC3986"/>, section 2.1.
    </t>
<t>
 <list style="symbols">
 <t>
fragment: This field is not used by the RESTCONF protocol.
 </t>
 </list>
</t>
    <t>
When new resources are created by the client, a &quot;Location&quot; header
is returned, which identifies the path of the newly created resource.
The client MUST use this exact path identifier to access
the resource once it has been created.
    </t>
    <t>
The &quot;target&quot; of an operation is a resource.
The &quot;path&quot; field in the request URI represents
the target resource for the operation.
    </t>
</section>
<section title="Message Headers" anchor="message-headers">
    <t>
There are several HTTP header lines utilized in RESTCONF messages.
Messages are not limited to the HTTP headers listed in this section.
    </t>
    <t>
HTTP defines which header lines are required for particular
circumstances. Refer to each operation definition section
in <xref target="operations"/> for examples on how particular headers are used.
    </t>
    <t>
There are some request headers that are used within RESTCONF,
usually applied to data resources.
The following tables summarize the headers most relevant
in RESTCONF message requests:
    </t>
<?rfc compact="yes"?><texttable title="RESTCONF Request Headers">
<ttcol align='left'> Name</ttcol>
<ttcol align='left'>Description</ttcol>
<c>Accept</c>
<c>Response Content-Types that are acceptable</c>
<c>Content-Type</c>
<c>The media type of the request body</c>
<c>Host</c>
<c>The host address of the server</c>
<c>If-Match</c>
<c>Only perform the action if the entity matches ETag</c>
<c>If-Modified-Since</c>
<c>Only perform the action if modified since time</c>
<c>If-Unmodified-Since</c>
<c>Only perform the action if un-modified since time</c>
</texttable>
<?rfc compact="no"?>    <t>
The following tables summarize the headers most relevant
in RESTCONF message responses:
    </t>
<?rfc compact="yes"?><texttable title="RESTCONF Response Headers">
<ttcol align='left'> Name</ttcol>
<ttcol align='left'>Description</ttcol>
<c>Allow</c>
<c>Valid actions when 405 error returned</c>
<c>Cache-Control</c>
<c>The cache control parameters for the response</c>
<c>Content-Type</c>
<c>The media type of the response message-body</c>
<c>Date</c>
<c>The date and time the message was sent</c>
<c>ETag</c>
<c>An identifier for a specific version of a resource</c>
<c>Last-Modified</c>
<c>The last modified date and time of a resource</c>
<c>Location</c>
<c>The resource identifier for a newly created resource</c>
</texttable>
<?rfc compact="no"?></section>
<section title="Message Encoding" anchor="message-encoding">
    <t>
RESTCONF messages are encoded in HTTP according to <xref target="RFC7230"/>.
The &quot;utf&#8209;8&quot; character set is used for all messages.
RESTCONF message content is sent in the HTTP message-body.
    </t>
    <t>
Content is encoded in either JSON or XML format.
A server MUST support XML or JSON encoding.
XML encoding rules for data nodes are defined in <xref target="I-D.ietf-netmod-rfc6020bis"/>.
The same encoding rules are used for all XML content.
JSON encoding rules are defined in <xref target="I-D.ietf-netmod-yang-json"/>.
JSON encoding of meta-data is defined in <xref target="I-D.ietf-netmod-yang-metadata"/>.
This encoding is valid JSON, but also has
special encoding rules to identify module namespaces
and provide consistent type processing of YANG data.
    </t>
    <t>
Request input content encoding format is identified with the Content-Type
header.  This field MUST be present if a message-body is sent
by the client.
    </t>
    <t>
The server MUST support the &quot;Accept&quot; header and &quot;406 Not Acceptable&quot;
status code, as defined in <xref target="RFC7231"/>.
Response output content encoding format is identified with the Accept
header in the request. If is not specified, the request
input encoding format is used.
If there was no request input, then the default output encoding
is XML or JSON, depending or server preference.
File extensions encoded in the request are not used to identify
format encoding.
    </t>
</section>
<section title="RESTCONF Meta-Data" anchor="restconf-meta-data">
    <t>
The RESTCONF protocol needs to retrieve the same meta-data that is
used in the NETCONF protocol.  Information about default leafs,
last-modified timestamps, etc. are commonly used to annotate
representations of the datastore contents.  This meta-data
is not defined in the YANG schema because it applies to the
datastore, and is common across all data nodes.
    </t>
    <t>
This information is encoded as attributes in XML.
JSON encoding of meta-data is defined in <xref target="I-D.ietf-netmod-yang-metadata"/>.
    </t>
    <t>
The following examples are based on the example in <xref target="with-defaults-example"/>.
The &quot;report&#8209;all&#8209;tagged&quot; mode for the &quot;with&#8209;defaults&quot; query parameter
requires that a &quot;default&quot; attribute be returned for default nodes.
This example shows that attribute for the &quot;mtu&quot; leaf .
    </t>
<section title="XML MetaData Encoding Example" anchor="xml-metadata-encoding-example">
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/interfaces/interface=eth1
       ?with-defaults=report-all-tagged HTTP/1.1
   Host: example.com
   Accept: application/yang.data+xml
	    ]]></artwork>
	</figure>
    <t>
The server might respond as follows.
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:01:00 GMT
   Server: example-server
   Content-Type: application/yang.data+xml
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
   <interface
     xmlns="urn:example.com:params:xml:ns:yang:example-interface">
     <name>eth1</name>
     <mtu xmlns:wd="urn:ietf:params:xml:ns:netconf:default:1.0"
       wd:default="true">1500</mtu>
     <status>up</status>
   </interface>
	    ]]></artwork>
	</figure>
</section>
<section title="JSON MetaData Encoding Example" anchor="json-metadata-encoding-example">
    <t>
Note that RFC 6243 defines the &quot;default&quot; attribute with XSD, not YANG,
so the YANG module name has to be assigned manually.
The value &quot;ietf&#8209;netconf&#8209;with&#8209;defaults&quot; is assigned for JSON meta-data
encoding.
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/interfaces/interface=eth1
       ?with-defaults=report-all-tagged HTTP/1.1
   Host: example.com
   Accept: application/yang.data+json
	    ]]></artwork>
	</figure>
    <t>
The server might respond as follows.
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:01:00 GMT
   Server: example-server
   Content-Type: application/yang.data+json

   {
     "example:interface": [
       {
         "name" : "eth1",
         "mtu" : 1500,
         "@mtu": {
            "ietf-netconf-with-defaults:default" : true
         },
         "status" : "up"
       }
     ]
   }
	    ]]></artwork>
	</figure>
</section>
</section>
<section title="Return Status" anchor="return-status">
    <t>
Each message represents some sort of resource access.
An HTTP &quot;status&#8209;line&quot; header line is returned for each request.
If a 4xx or 5xx range status code is returned in the status-line,
then the error information will be returned in the response,
according to the format defined in <xref target="errors"/>.
    </t>
</section>
<section title="Message Caching" anchor="message-caching">
    <t>
Since the datastore contents change at unpredictable times,
responses from a RESTCONF server generally SHOULD NOT be cached.
    </t>
    <t>
The server SHOULD include a &quot;Cache&#8209;Control&quot; header in every response
that specifies whether the response should be cached.  A &quot;Pragma&quot;
header specifying &quot;no&#8209;cache&quot; MAY also be sent in case the
&quot;Cache&#8209;Control&quot; header is not supported.
    </t>
    <t>
Instead of using HTTP caching, the client SHOULD track the &quot;ETag&quot;
and/or &quot;Last&#8209;Modified&quot; headers returned by the server for the
datastore resource (or data resource if the server supports it).
A retrieval request for a resource can include
the &quot;If&#8209;None&#8209;Match&quot; and/or &quot;If&#8209;Modified&#8209;Since&quot; headers, which
will cause the server to return a &quot;304 Not Modified&quot; status-line
if the resource has not changed.
The client MAY use the HEAD method to retrieve just
the message headers, which SHOULD include the &quot;ETag&quot;
and &quot;Last&#8209;Modified&quot; headers, if this meta-data is maintained
for the target resource.
    </t>
</section>
</section>
<section title="Notifications" anchor="notifications">
    <t>
The RESTCONF protocol supports YANG-defined event notifications.  The
solution preserves aspects of NETCONF Event Notifications <xref target="RFC5277"/>
while utilizing the Server-Sent Events <xref target="W3C.CR-eventsource-20121211"/>
transport strategy.
    </t>
<section title="Server Support" anchor="server-support">
    <t>
A RESTCONF server is not required to support RESTCONF notifications.
Clients may determine if a server supports RESTCONF notifications by
using the HTTP operation OPTIONS, HEAD, or GET on the stream list.
The server does not support RESTCONF notifications if an HTTP error
code is returned (e.g., 404 Not Found).
    </t>
</section>
<section title="Event Streams" anchor="event-streams">
    <t>
A RESTCONF server that supports notifications will populate a
stream resource for each notification delivery service access point.
A RESTCONF client can retrieve the list of supported event streams from
a RESTCONF server using the GET operation on the stream list.
    </t>
    <t>
The &quot;restconf&#8209;state/streams&quot; container definition in
the &quot;ietf&#8209;restconf&#8209;monitoring&quot; module
(defined in <xref target="mon-mod"/>) is used to specify the structure and syntax
of the conceptual child resources within the &quot;streams&quot; resource.
    </t>
    <t>
For example:
    </t>
    <t>
The client might send the following request:
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/ietf-restconf-monitoring:restconf-state/
       streams HTTP/1.1
   Host: example.com
   Accept: application/yang.data+xml
	    ]]></artwork>
	</figure>
    <t>
The server might send the following response:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Content-Type: application/yang.api+xml
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
   <streams
     xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring">
      <stream>
         <name>NETCONF</name>
         <description>default NETCONF event stream
         </description>
         <replay-support>true</replay-support>
         <replay-log-creation-time>
            2007-07-08T00:00:00Z
         </replay-log-creation-time>
         <access>
            <encoding>xml</encoding>
            <location>https://example.com/streams/NETCONF
            </location>
         </access>
         <access>
            <encoding>json</encoding>
            <location>https://example.com/streams/NETCONF-JSON
            </location>
         </access>
      </stream>
      <stream>
         <name>SNMP</name>
         <description>SNMP notifications</description>
         <replay-support>false</replay-support>
         <access>
            <encoding>xml</encoding>
            <location>https://example.com/streams/SNMP</location>
         </access>
      </stream>
      <stream>
         <name>syslog-critical</name>
         <description>Critical and higher severity
         </description>
         <replay-support>true</replay-support>
         <replay-log-creation-time>
            2007-07-01T00:00:00Z
         </replay-log-creation-time>
         <access>
            <encoding>xml</encoding>
            <location>
              https://example.com/streams/syslog-critical
            </location>
         </access>
      </stream>
   </streams>
	    ]]></artwork>
	</figure>
</section>
<section title="Subscribing to Receive Notifications" anchor="receive-notifs">
    <t>
RESTCONF clients can determine the URL for the subscription resource
(to receive notifications) by sending an
HTTP GET request for the &quot;location&quot; leaf with the stream list
entry. The value returned by the server can be used for the actual
notification subscription.
    </t>
    <t>
The client will send an HTTP GET request for the URL returned
by the server with the &quot;Accept&quot; type &quot;text/event&#8209;stream&quot;.
    </t>
    <t>
The server will treat the connection as an event stream, using the
Server Sent Events <xref target="W3C.CR-eventsource-20121211"/> transport strategy.
    </t>
    <t>
The server MAY support query parameters for a GET method on this
resource.  These parameters are specific to each notification stream.
    </t>
    <t>
For example:
    </t>
    <t>
The client might send the following request:
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/ietf-restconf-monitoring:restconf-state/
       streams/stream=NETCONF/access=xml/location HTTP/1.1
   Host: example.com
   Accept: application/yang.data+xml
	    ]]></artwork>
	</figure>
    <t>
The server might send the following response:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Content-Type: application/yang.api+xml
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
   <location
     xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring">
     https://example.com/streams/NETCONF
   </location>
	    ]]></artwork>
	</figure>
    <t>
The RESTCONF client can then use this URL value to start
monitoring the event stream:
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /streams/NETCONF HTTP/1.1
   Host: example.com
   Accept: text/event-stream
   Cache-Control: no-cache
   Connection: keep-alive
	    ]]></artwork>
	</figure>
    <t>
A RESTCONF client MAY request the server compress the events using
the HTTP header field &quot;Accept&#8209;Encoding&quot;.  For instance:
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /streams/NETCONF HTTP/1.1
   Host: example.com
   Accept: text/event-stream
   Cache-Control: no-cache
   Connection: keep-alive
   Accept-Encoding: gzip, deflate
	    ]]></artwork>
	</figure>
<section title="NETCONF Event Stream" anchor="netconf-event-stream">
    <t>
The server SHOULD support the &quot;NETCONF&quot; notification stream
defined in <xref target="RFC5277"/>.  For this stream,
RESTCONF notification subscription requests MAY specify parameters
indicating the events it wishes to receive. These query parameters
are optional to implement, and only available if the server supports
them.
    </t>
<?rfc compact="yes"?><texttable title="NETCONF Stream Query Parameters">
<ttcol align='left'> Name</ttcol>
<ttcol align='left'>Section</ttcol>
<ttcol align='left'>Description</ttcol>
<c>start-time</c>
<c><xref format="counter" target="start-time"/></c>
<c>replay event start time</c>
<c>stop-time</c>
<c><xref format="counter" target="stop-time"/></c>
<c>replay event stop time</c>
<c>filter</c>
<c><xref format="counter" target="filter"/></c>
<c>boolean content filter</c>
</texttable>
<?rfc compact="no"?>    <t>
The semantics and syntax for these query parameters are
defined in the sections listed above.
The YANG encoding MUST be converted to URL-encoded string
for use in the request URI.
    </t>
    <t>
Refer to <xref target="ex-filters"/> for filter parameter examples.
    </t>
</section>
</section>
<section title="Receiving Event Notifications" anchor="receiving-event-notifications">
    <t>
RESTCONF notifications are encoded according to the
definition of the event stream.  The NETCONF stream
defined in <xref target="RFC5277"/> is encoded in XML format.
    </t>
    <t>
The structure of the event data is based on the &quot;notification&quot;
element definition in Section 4 of <xref target="RFC5277"/>.
It MUST conform to the schema for the &quot;notification&quot; element
in Section 4 of <xref target="RFC5277"/>, except the XML namespace for
this element is defined as:
    </t>
	<figure>
	    <artwork><![CDATA[
  urn:ietf:params:xml:ns:yang:ietf-restconf
	    ]]></artwork>
	</figure>
    <t>
For JSON encoding purposes, the module name for
the &quot;notification&quot; element is &quot;ietf&#8209;restconf&quot;.
    </t>
    <t>
Two child nodes within the &quot;notification&quot; container
are expected, representing the event time and
the event payload.  The &quot;event&#8209;time&quot; node is
defined within the &quot;ietf&#8209;restconf&quot; module namespace.
The name and namespace of the payload element are determined
by the YANG module containing the notification-stmt.
    </t>
    <t>
In the following example, the YANG module &quot;example&#8209;mod&quot;
is used:
    </t>
	<figure>
	    <artwork><![CDATA[
  module example-mod {
    namespace "http://example.com/event/1.0";

    notification event {
     leaf event-class { type string; }
     container reporting-entity {
       leaf card { type string; }
     }
     leaf severity { type string; }
    }
  }
	    ]]></artwork>
	</figure>
    <t>
An example SSE event notification encoded using XML:
    </t>
	<figure>
	    <artwork><![CDATA[
   data: <notification
   data:    xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
   data:    <event-time>2013-12-21T00:01:00Z</event-time>
   data:    <event xmlns="http://example.com/event/1.0">
   data:       <event-class>fault</event-class>
   data:       <reporting-entity>
   data:           <card>Ethernet0</card>
   data:       </reporting-entity>
   data:       <severity>major</severity>
   data:     </event>
   data: </notification>
	    ]]></artwork>
	</figure>
    <t>
An example SSE event notification encoded using JSON:
    </t>
	<figure>
	    <artwork><![CDATA[
   data: {
   data:   "ietf-restconf:notification": {
   data:     "event-time": "2013-12-21T00:01:00Z",
   data:     "example-mod:event": {
   data:       "event-class": "fault",
   data:       "reporting-entity": { "card": "Ethernet0" },
   data:       "severity": "major"
   data:     }
   data:   }
   data: }
	    ]]></artwork>
	</figure>
    <t>
Alternatively, since neither XML nor JSON are whitespace sensitive,
the above messages can be encoded onto a single line.  For example:
    </t>
    <t>
For example:  (&apos;\&apos; line wrapping added for formatting only)
    </t>
	<figure>
	    <artwork><![CDATA[
   XML:

   data: <notification xmlns="urn:ietf:params:xml:ns:yang:ietf-rest\
   conf"><event-time>2013-12-21T00:01:00Z</event-time><event xmlns="\
   http://example.com/event/1.0"><event-class>fault</event-class><re\
   portingEntity><card>Ethernet0</card></reporting-entity><severity>\
   major</severity></event></notification>

   JSON:

   data: {"ietf-restconf:notification":{"event-time":"2013-12-21\
   T00:01:00Z","example-mod:event":{"event-class": "fault","repor\
   tingEntity":{"card":"Ethernet0"},"severity":"major"}}}
	    ]]></artwork>
	</figure>
    <t>
The SSE specifications supports the following additional fields:
event, id and retry.  A RESTCONF server MAY send the &quot;retry&quot; field
and, if it does, RESTCONF clients SHOULD use it.
A RESTCONF server SHOULD NOT send the &quot;event&quot; or &quot;id&quot; fields,
as there are no meaningful values that could be used for them
that would not be redundant to the contents of the notification itself.
RESTCONF servers that do not send the &quot;id&quot; field also do not need
to support the HTTP header &quot;Last&#8209;Event&#8209;Id&quot;.  RESTCONF servers that
do send the &quot;id&quot; field MUST still support the &quot;startTime&quot; query
parameter as the preferred means for a client to specify where to
restart the event stream.
    </t>
</section>
</section>
<section title="Error Reporting" anchor="error-reporting">
    <t>
HTTP status-lines are used to report success or failure
for RESTCONF operations.
The &lt;rpc&#8209;error&gt; element returned in NETCONF error responses
contains some useful information.  This error information
is adapted for use in RESTCONF, and error information
is returned for &quot;4xx&quot; class of status codes.
    </t>
    <t>
The following table summarizes the return status codes
used specifically by RESTCONF operations:
    </t>
<?rfc compact="yes"?><texttable title="HTTP Status Codes used in RESTCONF">
<ttcol align='left'> Status-Line</ttcol>
<ttcol align='left'>Description</ttcol>
<c>100 Continue</c>
<c>POST accepted, 201 should follow</c>
<c>200 OK</c>
<c>Success with response message-body</c>
<c>201 Created</c>
<c>POST to create a resource success</c>
<c>202 Accepted</c>
<c>POST to create a resource accepted</c>
<c>204 No Content</c>
<c>Success without response message-body</c>
<c>304 Not Modified</c>
<c>Conditional operation not done</c>
<c>400 Bad Request</c>
<c>Invalid request message</c>
<c>403 Forbidden</c>
<c>Access to resource denied</c>
<c>404 Not Found</c>
<c>Resource target or resource node not found</c>
<c>405 Method Not Allowed</c>
<c>Method not allowed for target resource</c>
<c>409 Conflict</c>
<c>Resource or lock in use</c>
<c>412 Precondition Failed</c>
<c>Conditional method is false</c>
<c>413 Request Entity Too Large</c>
<c>too-big error</c>
<c>414 Request-URI Too Large</c>
<c>too-big error</c>
<c>415 Unsupported Media Type</c>
<c>non RESTCONF media type</c>
<c>500 Internal Server Error</c>
<c>operation-failed</c>
<c>501 Not Implemented</c>
<c>unknown-operation</c>
<c>503 Service Unavailable</c>
<c>Recoverable server error</c>
</texttable>
<?rfc compact="no"?>    <t>
Since an operation resource is defined with a YANG &quot;action&quot; or &quot;rpc&quot;
statement, a mapping between the NETCONF &lt;error&#8209;tag&gt; value
and the HTTP status code is needed.   The specific error
condition and response code to use are data-model specific
and might be contained in the YANG &quot;description&quot; statement
for the &quot;action&quot; or &quot;rpc&quot; statement.
    </t>
<?rfc compact="yes"?><texttable title="Mapping from error-tag to status code">
<ttcol align='left'> &lt;error&#8209;tag&gt;</ttcol>
<ttcol align='left'>status code</ttcol>
<c>in-use</c>
<c>409</c>
<c>invalid-value</c>
<c>400</c>
<c>too-big</c>
<c>413</c>
<c>missing-attribute</c>
<c>400</c>
<c>bad-attribute</c>
<c>400</c>
<c>unknown-attribute</c>
<c>400</c>
<c>bad-element</c>
<c>400</c>
<c>unknown-element</c>
<c>400</c>
<c>unknown-namespace</c>
<c>400</c>
<c>access-denied</c>
<c>403</c>
<c>lock-denied</c>
<c>409</c>
<c>resource-denied</c>
<c>409</c>
<c>rollback-failed</c>
<c>500</c>
<c>data-exists</c>
<c>409</c>
<c>data-missing</c>
<c>409</c>
<c>operation-not-supported</c>
<c>501</c>
<c>operation-failed</c>
<c>500</c>
<c>partial-operation</c>
<c>500</c>
<c>malformed-message</c>
<c>400</c>
</texttable>
<?rfc compact="no"?><section title="Error Response Message" anchor="errors">
    <t>
When an error occurs for a request message on a data resource
or an operation resource, and a &quot;4xx&quot; class of status codes
(except for status code &quot;403 Forbidden&quot;),
then the server SHOULD send a response message-body containing
the information described by the &quot;errors&quot; container definition
within the YANG module <xref target="module"/>.  The Content-Type of this
response message MUST be application/yang.errors (see example
below).
    </t>
    <t>
The client MAY specify the desired encoding for error messages
by specifying the appropriate media-type in the Accept header.
If no error media is specified, then the media type of
the request message is used. If there is no request message
the server MUST select &quot;application/yang.errors+xml&quot;
or &quot;application/yang.errors+json&quot;, depending on server preference.
All of the examples
in this document, except for the one below, assume
that XML encoding will be returned if there is an error.
    </t>
    <t>
YANG Tree Diagram for &lt;errors&gt; data:
    </t>
	<figure>
	    <artwork><![CDATA[
   +--ro errors
      +--ro error*
         +--ro error-type       enumeration
         +--ro error-tag        string
         +--ro error-app-tag?   string
         +--ro error-path?      instance-identifier
         +--ro error-message?   string
         +--ro error-info
	    ]]></artwork>
	</figure>
    <t>
The semantics and syntax for RESTCONF error messages are
defined in the &quot;application/yang.errors&quot; restconf-media-type
extension in <xref target="module"/>.
    </t>
    <t>
Examples:
    </t>
    <t>
The following example shows an error returned for
an &quot;lock&#8209;denied&quot; error that can occur if a NETCONF
client has locked a datastore. The RESTCONF client
is attempting to delete a data resource.  Note that
an Accept header is used to specify the desired
encoding for the error message. This example&apos;s
use of the Accept header is especially notable
since the DELETE method typically doesn&apos;t return a
message-body and hence Accept headers are typically
not passed.
    </t>
	<figure>
	    <artwork><![CDATA[
   DELETE /restconf/data/example-jukebox:jukebox/
      library/artist=Foo%20Fighters/album=Wasting%20Light HTTP/1.1
   Host: example.com
   Accept: application/yang.errors+json
	    ]]></artwork>
	</figure>
    <t>
The server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 409 Conflict
   Date: Mon, 23 Apr 2012 17:11:00 GMT
   Server: example-server
   Content-Type: application/yang.errors+json

   {
     "ietf-restconf:errors": {
       "error": [
         {
           "error-type": "protocol",
           "error-tag": "lock-denied",
           "error-message": "Lock failed, lock already held"
         }
       ]
     }
   }
	    ]]></artwork>
	</figure>
    <t>
The following example shows an error returned for
a &quot;data&#8209;exists&quot; error on a data resource.
The &quot;jukebox&quot; resource already exists so it cannot be created.
    </t>
    <t>
The client might send:
    </t>
	<figure>
	    <artwork><![CDATA[
   POST /restconf/data/example-jukebox:jukebox HTTP/1.1
   Host: example.com
	    ]]></artwork>
	</figure>
    <t>
The server might respond (some lines wrapped for display purposes):
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 409 Conflict
   Date: Mon, 23 Apr 2012 17:11:00 GMT
   Server: example-server
   Content-Type: application/yang.errors+xml
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
   <errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
     <error>
       <error-type>protocol</error-type>
       <error-tag>data-exists</error-tag>
       <error-path
         xmlns:rc="urn:ietf:params:xml:ns:yang:ietf-restconf"
         xmlns:jb="https://example.com/ns/example-jukebox">
         /rc:restconf/rc:data/jb:jukebox
       </error-path>
       <error-message>
         Data already exists, cannot create new resource
       </error-message>
     </error>
   </errors>
	    ]]></artwork>
	</figure>
</section>
</section>
<section title="RESTCONF module" anchor="module">
    <t>
The &quot;ietf&#8209;restconf&quot; module defines conceptual definitions
within an extension and two groupings, which are
not meant to be implemented as datastore contents by a server.
E.g., the &quot;restconf&quot; container is not intended to be implemented
as a top-level data node (under the &quot;/restconf/data&quot; entry point).
    </t>
    <t>
RFC Ed.: update the date below with the date of RFC publication and
remove this note.
    </t>
<t>&lt;CODE BEGINS> file "ietf-restconf@2015-10-18.yang"</t>
	<figure>
	    <artwork><![CDATA[
module ietf-restconf {
  namespace "urn:ietf:params:xml:ns:yang:ietf-restconf";
  prefix "rc";

  organization
    "IETF NETCONF (Network Configuration) Working Group";

  contact
    "WG Web:   <http://tools.ietf.org/wg/netconf/>
     WG List:  <mailto:netconf@ietf.org>

     WG Chair: Mehmet Ersue
               <mailto:mehmet.ersue@nsn.com>

     WG Chair: Mahesh Jethanandani
               <mailto:mjethanandani@gmail.com>

     Editor:   Andy Bierman
               <mailto:andy@yumaworks.com>

     Editor:   Martin Bjorklund
               <mailto:mbj@tail-f.com>

     Editor:   Kent Watsen
               <mailto:kwatsen@juniper.net>";

  description
    "This module contains conceptual YANG specifications
     for basic RESTCONF media type definitions used in
     RESTCONF protocol messages.

     Note that the YANG definitions within this module do not
     represent configuration data of any kind.
     The 'restconf-media-type' YANG extension statement
     provides a normative syntax for XML and JSON message
     encoding purposes.

     Copyright (c) 2015 IETF Trust and the persons identified as
     authors of the code.  All rights reserved.

     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject
     to the license terms contained in, the Simplified BSD License
     set forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents
     (http://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC XXXX; see
     the RFC itself for full legal notices.";

  // RFC Ed.: replace XXXX with actual RFC number and remove this
  // note.

  // RFC Ed.: remove this note
  // Note: extracted from draft-ietf-netconf-restconf-08.txt

  // RFC Ed.: update the date below with the date of RFC publication
  // and remove this note.
  revision 2015-10-18 {
    description
      "Initial revision.";
    reference
      "RFC XXXX: RESTCONF Protocol.";
  }

  extension restconf-media-type {
   argument media-type-id {
     yin-element true;
   }
   // RFC Ed.: replace draft-ietf-netmod-yang-json with RFC number
   // in the description below, and remove this note.
   description
     "This extension is used to specify a YANG data structure which
      represents a conceptual RESTCONF media type.
      Data definition statements within this extension specify
      the generic syntax for the specific media type.

      YANG is mapped to specific encoding formats outside the
      scope of this extension statement. RFC 6020 defines XML
      encoding rules for all RESTCONF media types that use
      the '+xml' suffix. draft-ietf-netmod-yang-json defines
      JSON encoding rules for all RESTCONF media types that
      use the '+json' suffix.

      The 'media-type-id' parameter value identifies the media type
      that is being defined. It contains the string associated
      with the generic media type, i.e., no suffix is specified.

      This extension is ignored unless it appears as a top-level
      statement. It SHOULD contain data definition statements
      that result in exactly one container data node definition.
      This allows compliant translation to an XML instance
      document for each media type.

      The module name and namespace value for the YANG module using
      the extension statement is assigned to instance document data
      conforming to the data definition statements within
      this extension.

      The sub-statements of this extension MUST follow the
      'data-def-stmt' rule in the YANG ABNF.

      The XPath document root is the extension statement itself,
      such that the child nodes of the document root are
      represented by the data-def-stmt sub-statements within
      this extension. This conceptual document is the context
      for the following YANG statements:

         - must-stmt
         - when-stmt
         - path-stmt
         - min-elements-stmt
         - max-elements-stmt
         - mandatory-stmt
         - unique-stmt
         - ordered-by
         - instance-identifier data type

      The following data-def-stmt sub-statements have special
      meaning when used within a restconf-resource extension
      statement.

      - The list-stmt is not required to have a key-stmt defined.
      - The if-feature-stmt is ignored if present.
      - The config-stmt is ignored if present.
      - The available identity values for any 'identityref'
        leaf or leaf-list nodes is limited to the module
        containing this extension statement, and the modules
        imported into that module.
      ";
  }

  rc:restconf-media-type "application/yang.errors" {
    uses errors;
  }

  rc:restconf-media-type "application/yang.api" {
    uses restconf;
  }

  grouping errors {
    description
      "A grouping that contains a YANG container
       representing the syntax and semantics of a
       YANG Patch errors report within a response message.";

    container errors {
      description
        "Represents an error report returned by the server if
         a request results in an error.";

      list error {
        description
          "An entry containing information about one
           specific error that occurred while processing
           a RESTCONF request.";
        reference "RFC 6241, Section 4.3";

        leaf error-type {
          type enumeration {
            enum transport {
              description "The transport layer";
            }
            enum rpc {
              description "The rpc or notification layer";
            }
            enum protocol {
              description "The protocol operation layer";
            }
            enum application {
              description "The server application layer";
            }
          }
          mandatory true;
          description
            "The protocol layer where the error occurred.";
        }

        leaf error-tag {
          type string;
          mandatory true;
          description
            "The enumerated error tag.";
        }

        leaf error-app-tag {
          type string;
          description
            "The application-specific error tag.";
        }

        leaf error-path {
          type instance-identifier;
          description
            "The YANG instance identifier associated
             with the error node.";
        }

        leaf error-message {
          type string;
          description
            "A message describing the error.";
        }

        anyxml error-info {
           description
             "This anyxml value MUST represent a container with
             zero or more data nodes representing additional
             error information.";
        }
      }
    }
  }

  grouping restconf {
    description
      "Conceptual container representing the
       application/yang.api resource type.";

    container restconf {
      description
        "Conceptual container representing the
         application/yang.api resource type.";

      container data {
        description
          "Container representing the application/yang.datastore
           resource type. Represents the conceptual root of all
           operational data and configuration data supported by
           the server.  The child nodes of this container can be
           any data resource (application/yang.data), which are
           defined as top-level data nodes from the YANG modules
           advertised by the server in the ietf-restconf-monitoring
           module.";
      }

      container operations {
        description
          "Container for all operation resources
           (application/yang.operation),

           Each resource is represented as an empty leaf with the
           name of the RPC operation from the YANG rpc statement.

           E.g.;

              POST /restconf/operations/show-log-errors

              leaf show-log-errors {
                type empty;
              }
          ";
      }
    }
  }

}
	    ]]></artwork>
	</figure>
<t>&lt;CODE ENDS></t>
</section>
<section title="RESTCONF Monitoring" anchor="restconf-monitoring">
    <t>
The &quot;ietf&#8209;restconf&#8209;monitoring&quot; module provides information about
the RESTCONF protocol capabilities and event notification streams
available from the server.  A RESTCONF server MUST implement
the &quot;/restconf&#8209;state/capabilities&quot; container in this module.
    </t>
    <t>
YANG Tree Diagram for &quot;ietf&#8209;restconf&#8209;monitoring&quot; module:
    </t>
	<figure>
	    <artwork><![CDATA[
   +--ro restconf-state
      +--ro capabilities
      |  +--ro capability*   inet:uri
      +--ro streams
         +--ro stream* [name]
            +--ro name                        string
            +--ro description?                string
            +--ro replay-support?             boolean
            +--ro replay-log-creation-time?   yang:date-and-time
            +--ro access* [encoding]
               +--ro encoding  string
               +--ro location  inet:uri
	    ]]></artwork>
	</figure>
<section title="restconf-state/capabilities" anchor="restconf-statecapabilities">
    <t>
This mandatory container holds the RESTCONF
protocol capability URIs supported by the server.
    </t>
    <t>
The server MUST maintain a last-modified timestamp for this
container, and return the &quot;Last&#8209;Modified&quot; header when this
data node is retrieved with the GET or HEAD methods.
    </t>
    <t>
The server SHOULD maintain an entity-tag for this
container, and return the &quot;ETag&quot; header when this
data node is retrieved with the GET or HEAD methods.
    </t>
    <t>
The server MUST include a &quot;capability&quot; URI leaf-list entry for
the &quot;defaults&quot; mode used by the server, defined in <xref target="defaults-uri"/>.
    </t>
    <t>
The server MUST include a &quot;capability&quot; URI leaf-list entry identifying
each supported optional protocol feature. This includes optional
query parameters and MAY include other capability URIs defined
outside this document.
    </t>
<section title="Query Parameter URIs" anchor="query-parameter-uris">
    <t>
A new set of RESTCONF Capability URIs are defined to identify the specific
query parameters (defined in <xref target="query-parameters"/>)
supported by the server.
    </t>
    <t>
The server MUST include a &quot;capability&quot; leaf-list entry for each
optional query parameter that it supports.
    </t>
<?rfc compact="yes"?><texttable title="RESTCONF Query Parameter URIs">
<ttcol align='left'> Name</ttcol>
<ttcol align='left'>Section</ttcol>
<ttcol align='left'>URI</ttcol>
<c>depth</c>
<c><xref format="counter" target="depth"/></c>
<c>urn:ietf:params:restconf:capability:depth:1.0</c>
<c>fields</c>
<c><xref format="counter" target="fields"/></c>
<c>urn:ietf:params:restconf:capability:fields:1.0</c>
<c>filter</c>
<c><xref format="counter" target="filter"/></c>
<c>urn:ietf:params:restconf:capability:filter:1.0</c>
<c>replay</c>
<c><xref format="counter" target="start-time"/> <xref format="counter" target="stop-time"/></c>
<c>urn:ietf:params:restconf:capability:replay:1.0</c>
<c>with-defaults</c>
<c><xref format="counter" target="with-defaults"/></c>
<c>urn:ietf:params:restconf:capability:with-defaults:1.0</c>
</texttable>
<?rfc compact="no"?></section>
<section title="The &quot;defaults&quot; Protocol Capability URI" anchor="defaults-uri">
    <t>
This URI identifies the defaults handling mode that is used by the
server for processing default leafs in requests for data resources.
A parameter named &quot;basic&#8209;mode&quot; is required for this capability URI.
The &quot;basic&#8209;mode&quot; definitions are specified in the &quot;With-Defaults
Capability for NETCONF&quot; <xref target="RFC6243"/>.
    </t>
<?rfc compact="yes"?><texttable title="RESTCONF defaults capability URI">
<ttcol align='left'> Name</ttcol>
<ttcol align='left'>URI</ttcol>
<c>defaults</c>
<c>urn:ietf:params:restconf:capability:defaults:1.0</c>
</texttable>
<?rfc compact="no"?>    <t>
This protocol capability URI MUST be supported by the server, and
MUST be listed in the &quot;capability&quot; leaf-list in <xref target="mon-mod"/>.
    </t>
<?rfc compact="yes"?>
<texttable>
<ttcol align='left'>Value</ttcol>
<ttcol align='left'>Description</ttcol>
<c>report-all</c>
<c>No data nodes are considered default</c>
<c>trim</c>
<c>Values set to the YANG default-stmt value are default</c>
<c>explicit</c>
<c>Values set by the client are never considered default</c>
</texttable>
<?rfc compact="no"?>
    <t>
If the &quot;basic&#8209;mode&quot; is set to &quot;report&#8209;all&quot; then the server MUST
adhere to the defaults handling behavior defined in
Section 2.1 of <xref target="RFC6243"/>.
    </t>
    <t>
If the &quot;basic&#8209;mode&quot; is set to &quot;trim&quot; then the server MUST
adhere to the defaults handling behavior defined in
Section 2.2 of <xref target="RFC6243"/>.
    </t>
    <t>
If the &quot;basic&#8209;mode&quot; is set to &quot;explicit&quot; then the server MUST
adhere to the defaults handling behavior defined in
Section 2.3 of <xref target="RFC6243"/>.
    </t>
    <t>
Example: (split for display purposes only)
    </t>
	<figure>
	    <artwork><![CDATA[
   urn:ietf:params:restconf:capability:defaults:1.0?
        basic-mode=explicit
	    ]]></artwork>
	</figure>
</section>
</section>
<section title="restconf-state/streams" anchor="restconf-statestreams">
    <t>
This optional container provides access to the
event notification streams supported by the server.
The server MAY omit this container if no
event notification streams are supported.
    </t>
    <t>
The server will populate this container with a stream list entry for
each stream type it supports.  Each stream contains a leaf
called &quot;events&quot; which contains a URI that
represents an event stream resource.
    </t>
    <t>
Stream resources are defined in <xref target="stream-resource"/>.
Notifications are defined in <xref target="notifications"/>.
    </t>
</section>
<section title="RESTCONF Monitoring Module" anchor="mon-mod">
    <t>
The &quot;ietf&#8209;restconf&#8209;monitoring&quot; module defines monitoring
information for the RESTCONF protocol.
    </t>
    <t>
The &quot;ietf&#8209;yang&#8209;types&quot; and &quot;ietf&#8209;inet&#8209;types&quot; modules from <xref target="RFC6991"/>
are used by this module for some type definitions.
    </t>
    <t>
RFC Ed.: update the date below with the date of RFC publication and
remove this note.
    </t>
<t>&lt;CODE BEGINS> file "ietf-restconf-monitoring@2015-06-19.yang"</t>
	<figure>
	    <artwork><![CDATA[
module ietf-restconf-monitoring {
  namespace "urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring";
  prefix "rcmon";

  import ietf-yang-types { prefix yang; }
  import ietf-inet-types { prefix inet; }

  organization
    "IETF NETCONF (Network Configuration) Working Group";

  contact
    "WG Web:   <http://tools.ietf.org/wg/netconf/>
     WG List:  <mailto:netconf@ietf.org>

     WG Chair: Mehmet Ersue
               <mailto:mehmet.ersue@nsn.com>

     WG Chair: Mahesh Jethanandani
               <mailto:mjethanandani@gmail.com>

     Editor:   Andy Bierman
               <mailto:andy@yumaworks.com>

     Editor:   Martin Bjorklund
               <mailto:mbj@tail-f.com>

     Editor:   Kent Watsen
               <mailto:kwatsen@juniper.net>";

  description
    "This module contains monitoring information for the
     RESTCONF protocol.

     Copyright (c) 2015 IETF Trust and the persons identified as
     authors of the code.  All rights reserved.

     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject
     to the license terms contained in, the Simplified BSD License
     set forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents
     (http://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC XXXX; see
     the RFC itself for full legal notices.";

  // RFC Ed.: replace XXXX with actual RFC number and remove this
  // note.

  // RFC Ed.: remove this note
  // Note: extracted from draft-ietf-netconf-restconf-08.txt

  // RFC Ed.: update the date below with the date of RFC publication
  // and remove this note.
  revision 2015-06-19 {
    description
      "Initial revision.";
    reference
      "RFC XXXX: RESTCONF Protocol.";
  }

  container restconf-state {
    config false;
    description
      "Contains RESTCONF protocol monitoring information.";

    container capabilities {
      description
        "Contains a list of protocol capability URIs";

      leaf-list capability {
        type inet:uri;
        description "A RESTCONF protocol capability URI.";
      }
    } 

    container streams {
      description
        "Container representing the notification event streams
         supported by the server.";
       reference
         "RFC 5277, Section 3.4, <streams> element.";

      list stream {
        key name;
        description
          "Each entry describes an event stream supported by
           the server.";

        leaf name {
          type string;
          description "The stream name";
          reference "RFC 5277, Section 3.4, <name> element.";
        }

        leaf description {
          type string;
          description "Description of stream content";
          reference
            "RFC 5277, Section 3.4, <description> element.";
        }

        leaf replay-support {
          type boolean;
          description
            "Indicates if replay buffer supported for this stream.
             If 'true', then the server MUST support the 'start-time'
             and 'stop-time' query parameters for this stream.";
          reference
            "RFC 5277, Section 3.4, <replaySupport> element.";
        }

        leaf replay-log-creation-time {
          when "../replay-support" {
            description
              "Only present if notification replay is supported";
          }
          type yang:date-and-time;
          description
            "Indicates the time the replay log for this stream
             was created.";
          reference
            "RFC 5277, Section 3.4, <replayLogCreationTime>
             element.";
        }

        list access {
          key encoding;
          min-elements 1;
          description
            "The server will create an entry in this list for each
             encoding format that is supported for this stream.
             The media type 'application/yang.stream' is expected
             for all event streams. This list identifies the
             sub-types supported for this stream.";

          leaf encoding {
            type string;
            description
              "This is the secondary encoding format within the
               'text/event-stream' encoding used by all streams.
               The type 'xml' is supported for the media type
               'application/yang.stream+xml'. The type 'json'
               is supported for the media type
               'application/yang.stream+json'.";

          }

          leaf location {
            type inet:uri;
            mandatory true;
            description
              "Contains a URL that represents the entry point
               for establishing notification delivery via server
               sent events.";
          }
        }
      }
    }
  }

}
	    ]]></artwork>
	</figure>
<t>&lt;CODE ENDS></t>
</section>
</section>
<section title="YANG Module Library" anchor="yang-module-library">
    <t>
The &quot;ietf&#8209;yang&#8209;library&quot; module defined in <xref target="I-D.ietf-netconf-yang-library"/>
provides information about
the YANG modules and submodules used by the RESTCONF server.
Implementation is mandatory for RESTCONF servers.
All YANG modules and submodules used by the server MUST
be identified in the YANG module library.
    </t>
<section title="modules" anchor="modules">
    <t>
This mandatory container holds the identifiers
for the YANG data model modules supported by the server.
    </t>
    <t>
The server MUST maintain a last-modified timestamp for this
container, and return the &quot;Last&#8209;Modified&quot; header when this
data node is retrieved with the GET or HEAD methods.
    </t>
    <t>
The server SHOULD maintain an entity-tag for this
container, and return the &quot;ETag&quot; header when this
data node is retrieved with the GET or HEAD methods.
    </t>
<section title="modules/module" anchor="modulesmodule">
    <t>
This mandatory list contains one entry
for each YANG data model module supported by the server.
There MUST be an instance of this list for every
YANG module that is used by the server.
    </t>
    <t>
The contents of this list are defined in
the &quot;module&quot; YANG list statement in <xref target="I-D.ietf-netconf-yang-library"/>.
    </t>
    <t>
The server MAY maintain a last-modified timestamp for
each instance of this list entry, and return the
&quot;Last&#8209;Modified&quot; header when this data node is retrieved
with the GET or HEAD methods.  If not supported
then the timestamp for the parent &quot;modules&quot; container
MAY be used instead.
    </t>
    <t>
The server MAY maintain an entity-tag for each instance
of this list entry, and return the &quot;ETag&quot; header when this
data node is retrieved with the GET or HEAD methods.
If not supported then the timestamp for the
parent &quot;modules&quot; container MAY be used instead.
    </t>
</section>
</section>
</section>
<section title="IANA Considerations" anchor="iana">
<section title="The &quot;restconf&quot; Relation Type" anchor="the-restconf-relation-type">
    <t>
This specification registers the &quot;restconf&quot; relation type in the Link
Relation Type Registry defined by <xref target="RFC5988"/>:
    </t>
	<figure>
	    <artwork><![CDATA[
   Relation Name:  restconf

   Description:  Identifies the root of RESTCONF API as configured
                 on this HTTP server.  The "restconf" relation
                 defines the root of the API defined in RFCXXXX.
                 Subsequent revisions of RESTCONF will use alternate
                 relation values to support protocol versioning.

   Reference:  RFC XXXX
	    ]]></artwork>
	</figure>
    <t>
`
    </t>
</section>
<section title="YANG Module Registry" anchor="yang-module-registry">
    <t>
This document registers two URIs in the IETF XML registry
<xref target="RFC3688"/>. Following the format in RFC 3688, the following
registration is requested to be made.
    </t>
	<figure>
	    <artwork><![CDATA[
     URI: urn:ietf:params:xml:ns:yang:ietf-restconf
     Registrant Contact: The NETMOD WG of the IETF.
     XML: N/A, the requested URI is an XML namespace.

     URI: urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring
     Registrant Contact: The NETMOD WG of the IETF.
     XML: N/A, the requested URI is an XML namespace.
	    ]]></artwork>
	</figure>
    <t>
This document registers two YANG modules in the YANG Module Names
registry <xref target="RFC6020"/>.
    </t>
	<figure>
	    <artwork><![CDATA[
  name:         ietf-restconf
  namespace:    urn:ietf:params:xml:ns:yang:ietf-restconf
  prefix:       rc
  // RFC Ed.: replace XXXX with RFC number and remove this note
  reference:    RFC XXXX

  name:         ietf-restconf-monitoring
  namespace:    urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring
  prefix:       rcmon
  // RFC Ed.: replace XXXX with RFC number and remove this note
  reference:    RFC XXXX
	    ]]></artwork>
	</figure>
</section>
<section title="application/yang Media Sub Types" anchor="applicationyang-media-sub-types">
    <t>
The parent MIME media type for RESTCONF resources is application/yang,
which is defined in <xref target="RFC6020"/>.  This document defines the following
sub-types for this media type.
    </t>
	<figure>
	    <artwork><![CDATA[
   - api
   - data
   - datastore
   - errors
   - operation
   - stream

   Type name: application

   Subtype name: yang.xxx

   Required parameters: none

   Optional parameters: See section 4.8 in RFC XXXX

   Encoding considerations: 8-bit

   Security considerations: See Section 12 in RFC XXXX

   Interoperability considerations: none

   // RFC Ed.: replace XXXX with RFC number and remove this note
   Published specification: RFC XXXX
	    ]]></artwork>
	</figure>
</section>
<section title="RESTCONF Capability URNs" anchor="restconf-capability-urns">
	<figure>
	    <artwork><![CDATA[
   [Note to RFC Editor:
    The RESTCONF Protocol Capability Registry does not yet exist;
    Need to ask IANA to create it; remove this note for publication
   ]
	    ]]></artwork>
	</figure>
    <t>
This document defines a registry for RESTCONF capability identifiers.
The name of the registry is &quot;RESTCONF Capability URNs&quot;.
The registry shall record for each entry:
    </t>
<t>
 <list style="symbols">
 <t>
the name of the RESTCONF capability. By convention, this name is
prefixed with the colon &apos;:&apos; character.
 </t>
 <t>
the URN for the RESTCONF capability.
 </t>
 </list>
</t>
    <t>
This document registers several capability identifiers in
&quot;RESTCONF Capability URNs&quot; registry:
    </t>
	<figure>
	    <artwork><![CDATA[
  Index
     Capability Identifier
  ------------------------

  :defaults
      urn:ietf:params:restconf:capability:defaults:1.0

  :depth
      urn:ietf:params:restconf:capability:depth:1.0

  :fields
      urn:ietf:params:restconf:capability:fields:1.0

  :filter
      urn:ietf:params:restconf:capability:filter:1.0

  :replay
      urn:ietf:params:restconf:capability:replay:1.0

  :with-defaults
      urn:ietf:params:restconf:capability:with-defaults:1.0
	    ]]></artwork>
	</figure>
</section>
</section>
<section title="Security Considerations" anchor="security-considerations">
    <t>
This section provides security considerations for the resources
defined by the RESTCONF protocol.  Security considerations for
HTTPS are defined in <xref target="RFC2818"/>.  Security considerations for the
content manipulated by RESTCONF can be found in the documents
defining data models.
    </t>
    <t>
This document does not specify an authentication scheme, but
it does require that an authenticated NETCONF username be
associated with each HTTP request.  The authentication scheme
MAY be implemented in the underlying transport layer (e.g.,
client certificates) or within the HTTP layer (e.g., Basic
Auth, OAuth, etc.).  RESTCONF does not itself define an
authentication mechanism. Authentication MUST occur in a
lower layer.  Implementors SHOULD provide a comprehensive
authorization scheme with RESTCONF and ensure that the resulting
NETCONF username is made available to the RESTCONF server.
    </t>
    <t>
Authorization of individual user access to operations and data
MAY be configured via NETCONF Access Control Model (NACM)
<xref target="RFC6536"/>, as specified in <xref target="operations"/>.
    </t>
    <t>
Configuration information is by its very nature sensitive.  Its
transmission in the clear and without integrity checking leaves
devices open to classic eavesdropping and false data injection
attacks.  Configuration information often contains passwords, user
names, service descriptions, and topological information, all of
which are sensitive.  Because of this, this protocol SHOULD be
implemented carefully with adequate attention to all manner of attack
one might expect to experience with other management interfaces.
    </t>
    <t>
Different environments may well allow different rights prior to and
then after authentication.  When an operation is not properly authorized,
the RESTCONF server MUST return HTTP error status code 401 Unauthorized.
Note that authorization information can be exchanged in the form of
configuration information, which is all the more reason to ensure the
security of the connection.
    </t>
</section>
<section title="Acknowledgements" anchor="acknowledgements">
    <t>
The authors would like to thank the following people for
their contributions to this document: Ladislav Lhotka,
Juergen Schoenwaelder, Rex Fernando, Robert Wilton,
and Jonathan Hansford.
    </t>
    <t>
Contributions to this material by Andy Bierman are based upon work
supported by the The Space &amp; Terrestrial Communications Directorate
(S&amp;TCD) under Contract No. W15P7T-13-C-A616. Any opinions, findings
and conclusions or recommendations expressed in this material are
those of the author(s) and do not necessarily reflect the views of
The Space &amp; Terrestrial Communications Directorate (S&amp;TCD).
    </t>
</section>
</middle>
<back>
<references title="Normative References">

  <reference anchor='RFC2046'>
    <front>
      <title abbrev='Media Types'>Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types</title>
      <author initials='N.' surname='Freed' fullname='Ned Freed'>
        <organization>Innosoft International, Inc.</organization>
      </author>
      <author initials='N.' surname='Borenstein' fullname='Nathaniel S. Borenstein'>
        <organization>First Virtual Holdings</organization>
      </author>
      <date year='1996' month='November' />
    </front>
    <seriesInfo name='RFC' value='2046' />
    <format type='TXT' octets='105854' target='http://www.rfc-editor.org/rfc/rfc2046.txt' />
  </reference>

  <reference anchor="RFC2119">
    <front>
      <title>Key words for use in RFCs to Indicate Requirement Levels</title>
      <author initials="S." surname="Bradner" fullname="S.  Bradner">
        <organization>Harvard University</organization>
      </author>
      <date month="March" year="1997"/>
      <abstract>
        <t>In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized.  This document defines these words as they should be interpreted in IETF documents.</t>
      </abstract>
    </front>
    <seriesInfo name="BCP" value="14"/>
    <seriesInfo name="RFC" value="2119"/>
    <format type="TXT" octets="4723" target="ftp://ftp.isi.edu/in-notes/rfc2119.txt"/>
  </reference>

<!--  
  <reference anchor="RFC2246">
    <front>
      <title>The TLS Protocol, Version 1.0</title>
      <author initials="T.D" surname="Dierks" fullname="Tim  Dierks">
        <organization>Certicom</organization>
      </author>
      <author initials="C.A" surname="Allen" fullname="Christopher  Allen">
        <organization>Certicom</organization>
      </author>
      <date month="January" year="1999"/>
      <abstract>
        <t>This document specifies Version 1.0 of the Transport Layer Security
        (TLS) protocol. The TLS protocol provides communications privacy over
        the Internet. The protocol allows client/server applications to
        communicate in a way that is designed to prevent eavesdropping,
        tampering, or message forgery.</t>
      </abstract>
    </front>
    <seriesInfo name="RFC" value="2246"/>
    <format type="HTTP" octets="205788" target="http://tools.ietf.org/html/rfc2246"/>
  </reference>
 -->

<!--
<reference anchor='RFC2396'>

<front>
<title abbrev='URI Generic Syntax'>Uniform Resource Identifiers (URI): Generic Syntax</title>
<author initials='T.' surname='Berners-Lee' fullname='Tim Berners-Lee'>
<organization abbrev='MIT/LCS'>World Wide Web Consortium</organization>
<address>
<postal>
<street>MIT Laboratory for Computer Science, NE43-356</street>
<street>545 Technology Square</street>
<city>Cambridge</city>
<region>MA</region>
<code>02139</code></postal>
<facsimile>+1(617)258-8682</facsimile>
<email>timbl@w3.org</email></address></author>
<author initials='R.T.' surname='Fielding' fullname='Roy T. Fielding'>
<organization abbrev='U.C. Irvine'>Department of Information and Computer Science</organization>
<address>
<postal>
<street>University of California, Irvine</street>
<city>Irvine</city>
<region>CA</region>
<code>92697-3425</code></postal>
<facsimile>+1(949)824-1715</facsimile>
<email>fielding@ics.uci.edu</email></address></author>
<author initials='L.' surname='Masinter' fullname='Larry Masinter'>
<organization abbrev='Xerox Corporation'>Xerox PARC</organization>
<address>
<postal>
<street>3333 Coyote Hill Road</street>
<city>Palo Alto</city>
<region>CA</region>
<code>94034</code></postal>
<facsimile>+1(415)812-4333</facsimile>
<email>masinter@parc.xerox.com</email></address></author>
<date year='1998' month='August' />
<area>Applications</area>
<keyword>uniform resource</keyword>
<keyword>URI</keyword>
<abstract>
<t>
   A Uniform Resource Identifier (URI) is a compact string of characters
   for identifying an abstract or physical resource.  This document
   defines the generic syntax of URI, including both absolute and
   relative forms, and guidelines for their use; it revises and replaces
   the generic definitions in RFC 1738 and RFC 1808.
</t>
<t>
   This document defines a grammar that is a superset of all valid URI,
   such that an implementation can parse the common components of a URI
   reference without knowing the scheme-specific requirements of every
   possible identifier type.  This document does not define a generative
   grammar for URI; that task will be performed by the individual
   specifications of each URI scheme.
</t></abstract>
<note title='IESG Note'>
<t>
   This paper describes a "superset" of operations that can be applied
   to URI.  It consists of both a grammar and a description of basic
   functionality for URI.  To understand what is a valid URI, both the
   grammar and the associated description have to be studied.  Some of
   the functionality described is not applicable to all URI schemes, and
   some operations are only possible when certain media types are
   retrieved using the URI, regardless of the scheme used.
</t></note></front>

<seriesInfo name='RFC' value='2396' />
<format type='TXT' octets='83639' target='http://www.rfc-editor.org/rfc/rfc2396.txt' />
<format type='HTML' octets='130638' target='http://xml.resource.org/public/rfc/html/rfc2396.html' />
<format type='XML' octets='104983' target='http://xml.resource.org/public/rfc/xml/rfc2396.xml' />
</reference>
  -->
<!-- end RFC 2396 -->


<reference anchor='RFC5246'>
<front>
<title>The Transport Layer Security (TLS) Protocol Version 1.2</title>
<author initials='T.' surname='Dierks' fullname='T. Dierks'>
<organization /></author>
<author initials='E.' surname='Rescorla' fullname='E. Rescorla'>
<organization /></author>
<date year='2008' month='August' />
<abstract>
<t>This document specifies Version 1.2 of the Transport Layer Security (TLS) protocol.  The TLS protocol provides communications security over the Internet.  The protocol allows client/server applications to communicate in a way that is designed to prevent eavesdropping, tampering, or message forgery. [STANDARDS-TRACK]</t></abstract></front>
<seriesInfo name='RFC' value='5246' />
<format type='TXT' octets='222395' target='http://www.rfc-editor.org/rfc/rfc5246.txt' />
</reference>


<reference anchor='RFC6125'>
<front>
<title>Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)</title>
<author initials='P.' surname='Saint-Andre' fullname='P. Saint-Andre'>
<organization /></author>
<author initials='J.' surname='Hodges' fullname='J. Hodges'>
<organization /></author>
<date year='2011' month='March' />
<abstract>
<t>Many application technologies enable secure communication between two entities by means of Internet Public Key Infrastructure Using X.509 (PKIX) certificates in the context of Transport Layer Security (TLS).  This document specifies procedures for representing and verifying the identity of application services in such interactions. [STANDARDS-TRACK]</t></abstract></front>
<seriesInfo name='RFC' value='6125' />
<format type='TXT' octets='136507' target='http://www.rfc-editor.org/rfc/rfc6125.txt' />
</reference>



<reference anchor='RFC7230'>

<front>
<title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title>
<author initials='R.' surname='Fielding' fullname='R. Fielding'>
<organization /></author>
<author initials='J.' surname='Reschke' fullname='J. Reschke'>
<organization /></author>
<date year='2014' month='June' />
<abstract>
<t>The Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for distributed, collaborative, hypertext information systems.  This document provides an overview of HTTP architecture and its associated terminology, defines the "http" and "https" Uniform Resource Identifier (URI) schemes, defines the HTTP/1.1 message syntax and parsing requirements, and describes related security concerns for implementations.</t></abstract></front>

<seriesInfo name='RFC' value='7230' />
<format type='TXT' octets='205947' target='http://www.rfc-editor.org/rfc/rfc7230.txt' />
</reference>

<reference anchor='RFC7231'>

<front>
<title>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</title>
<author initials='R.' surname='Fielding' fullname='R. Fielding'>
<organization /></author>
<author initials='J.' surname='Reschke' fullname='J. Reschke'>
<organization /></author>
<date year='2014' month='June' />
<abstract>
<t>The Hypertext Transfer Protocol (HTTP) is a stateless \%application- level protocol for distributed, collaborative, hypertext information systems.  This document defines the semantics of HTTP/1.1 messages, as expressed by request methods, request header fields, response status codes, and response header fields, along with the payload of messages (metadata and body content) and mechanisms for content negotiation.</t></abstract></front>

<seriesInfo name='RFC' value='7231' />
<format type='TXT' octets='235053' target='http://www.rfc-editor.org/rfc/rfc7231.txt' />
</reference>

  <reference anchor='RFC2818'>
    <front>
      <title>The IETF XML Registry</title>
      <author initials='E.R.' surname='Rescorla' fullname='Erir Rescorla'>
        <organization>RTFM, Inc.</organization></author>
      <date year='2000' month='May' />
      <abstract>
        <t>This memo describes how to use TLS to secure HTTP connections over
   the Internet. Current practice is to layer HTTP over SSL (the
   predecessor to TLS), distinguishing secured traffic from insecure
   traffic by the use of a different server port. This document
   documents that practice using TLS. A companion document describes a
   method for using HTTP/TLS over the same port as normal HTTP
   [RFC2817].</t>
      </abstract>
    </front>
    <seriesInfo name='RFC' value='2818' />
    <format type='HTTP' octets='26507' target='http://tools.ietf.org/html/rfc2818' />
  </reference>
  
<reference anchor='RFC7232'>

<front>
<title>Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</title>
<author initials='R.' surname='Fielding' fullname='R. Fielding'>
<organization /></author>
<author initials='J.' surname='Reschke' fullname='J. Reschke'>
<organization /></author>
<date year='2014' month='June' />
<abstract>
<t>The Hypertext Transfer Protocol (HTTP) is a stateless application- level protocol for distributed, collaborative, hypertext information systems.  This document defines HTTP/1.1 conditional requests, including metadata header fields for indicating state changes, request header fields for making preconditions on such state, and rules for constructing the responses to a conditional request when one or more preconditions evaluate to false.</t></abstract></front>
<seriesInfo name='RFC' value='7232' />
<format type='TXT' octets='56696' target='http://www.rfc-editor.org/rfc/rfc7232.txt' />
</reference>





<reference anchor='RFC7235'>
<front>
<title>Hypertext Transfer Protocol (HTTP/1.1): Authentication</title>
<author initials='R.' surname='Fielding' fullname='R. Fielding'>
<organization /></author>
<author initials='J.' surname='Reschke' fullname='J. Reschke'>
<organization /></author>
<date year='2014' month='June' />
<abstract>
<t>The Hypertext Transfer Protocol (HTTP) is a stateless application- level protocol for distributed, collaborative, hypermedia information systems.  This document defines the HTTP Authentication framework.</t></abstract></front>
<seriesInfo name='RFC' value='7235' />
<format type='TXT' octets='38142' target='http://www.rfc-editor.org/rfc/rfc7235.txt' />
</reference>




  <reference anchor='RFC3688'>
    <front>
      <title>The IETF XML Registry</title>
      <author initials='M.' surname='Mealling' fullname='M. Mealling'>
        <organization /></author>
      <date year='2004' month='January' />
      <abstract>
        <t>This document describes an IANA maintained registry for IETF standards which use Extensible Markup Language (XML) related items such as Namespaces, Document Type Declarations (DTDs), Schemas, and Resource Description Framework (RDF) Schemas.</t></abstract></front>
    
    <seriesInfo name='BCP' value='81' />
    <seriesInfo name='RFC' value='3688' />
    <format type='TXT' octets='17325' target='http://www.rfc-editor.org/rfc/rfc3688.txt' />
  </reference>



<reference anchor="RFC3986">
<front>
<title abbrev="URI Generic Syntax">Uniform Resource Identifier (URI): Generic Syntax</title>
<author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
<organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
<address>
<postal>
<street>Massachusetts Institute of Technology</street>
<street>77 Massachusetts Avenue</street>
<city>Cambridge</city>
<region>MA</region>
<code>02139</code>
<country>USA</country></postal>
<phone>+1-617-253-5702</phone>
<facsimile>+1-617-258-5999</facsimile>
<email>timbl@w3.org</email>
<uri>http://www.w3.org/People/Berners-Lee/</uri></address></author>
<author initials="R." surname="Fielding" fullname="Roy T. Fielding">
<organization abbrev="Day Software">Day Software</organization>
<address>
<postal>
<street>5251 California Ave., Suite 110</street>
<city>Irvine</city>
<region>CA</region>
<code>92617</code>
<country>USA</country></postal>
<phone>+1-949-679-2960</phone>
<facsimile>+1-949-679-2972</facsimile>
<email>fielding@gbiv.com</email>
<uri>http://roy.gbiv.com/</uri></address></author>
<author initials="L." surname="Masinter" fullname="Larry Masinter">
<organization abbrev="Adobe Systems">Adobe Systems Incorporated</organization>
<address>
<postal>
<street>345 Park Ave</street>
<city>San Jose</city>
<region>CA</region>
<code>95110</code>
<country>USA</country></postal>
<phone>+1-408-536-3024</phone>
<email>LMM@acm.org</email>
<uri>http://larry.masinter.net/</uri></address></author>
<date year="2005" month="January"/>
<area>Applications</area>
<keyword>uniform resource identifier</keyword>
<keyword>URI</keyword>
<keyword>URL</keyword>
<keyword>URN</keyword>
<keyword>WWW</keyword>
<keyword>resource</keyword>
<abstract>
<t>
A Uniform Resource Identifier (URI) is a compact sequence of characters
that identifies an abstract or physical resource.  This specification
defines the generic URI syntax and a process for resolving URI references
that might be in relative form, along with guidelines and security
considerations for the use of URIs on the Internet.
The URI syntax defines a grammar that is a superset of all valid URIs,
allowing an implementation to parse the common components of a URI
reference without knowing the scheme-specific requirements of every
possible identifier.  This specification does not define a generative
grammar for URIs; that task is performed by the individual
specifications of each URI scheme.
</t></abstract></front>

<seriesInfo name="STD" value="66"/>
<seriesInfo name="RFC" value="3986"/>
<format type="TXT" octets="141811" target="http://www.rfc-editor.org/rfc/rfc3986.txt"/>
<format type="HTML" octets="213584" target="http://xml.resource.org/public/rfc/html/rfc3986.html"/>
<format type="XML" octets="163534" target="http://xml.resource.org/public/rfc/xml/rfc3986.xml"/>
</reference>



  <reference anchor='RFC5277'>
      <front>
        <title>NETCONF Event Notifications</title>
        <author initials='S.C.' surname='Chisholm' fullname='S. Chisholm'>
          <organization>Nortel</organization>
        </author>
        <author initials='H.T.' surname='Trevino' fullname='H. Trevino'>
          <organization>Cisco</organization>
        </author>
        <date year='2008' month='July'/>
        <abstract>
        <t>YANG is a data modeling language used to model configuration and state data manipulated by the Network Configuration Protocol (NETCONF), NETCONF remote procedure calls, and NETCONF notifications. [STANDARDS TRACK]</t>
      </abstract>
      </front>
      <seriesInfo name='RFC' value='5277'/>
    <format type="HTML" octets="96192" target="http://tools.ietf.org/html/rfc5277.html"/>
  </reference>


  <reference anchor='RFC5280'>
      <front>
        <title>Internet X.509 Public Key Infrastructure Certificate
             and Certificate Revocation List (CRL) Profile</title>

        <author initials='D.C.' surname='Cooper' fullname='David Cooper'>
          <organization>NIST</organization>
        </author>
        <author initials='S.S.' surname='Santesson' fullname='Stefan Santesson'>
          <organization>Microsoft</organization>
        </author>
        <author initials='S.F.' surname='Farrell' fullname='Stephen Farrell'>
          <organization>Trinity College Dublin</organization>
        </author>
        <author initials='S.B.' surname='Boeyen' fullname='Sharon Boeyen'>
          <organization>Entrust</organization>
        </author>
        <author initials='R.H.' surname='Housley' fullname='Russell Housley'>
          <organization>Vigil Security</organization>
        </author>
        <author initials='T.P.' surname='Polk' fullname='Tim Polk'>
          <organization>NIST</organization>
        </author>
        <date year='2008' month='May'/>
        <abstract>
          <t>This memo profiles the X.509 v3 certificate and X.509 v2 certificate
   revocation list (CRL) for use in the Internet.  An overview of this
   approach and model is provided as an introduction.  The X.509 v3
   certificate format is described in detail, with additional
   information regarding the format and semantics of Internet name
   forms.  Standard certificate extensions are described and two
   Internet-specific extensions are defined.  A set of required
   certificate extensions is specified.  The X.509 v2 CRL format is
   described in detail along with standard and Internet-specific
   extensions.  An algorithm for X.509 certification path validation is
   described.  An ASN.1 module and examples are provided in the
   appendices.</t>
      </abstract>
      </front>
      <seriesInfo name='RFC' value='5280'/>
    <format type="HTML" octets="430252" target="http://tools.ietf.org/html/rfc5280"/>
  </reference>





<reference anchor="RFC5789">

<front>
<title>PATCH Method for HTTP</title>
<author initials="L." surname="Dusseault" fullname="L. Dusseault">
<organization/></author>
<author initials="J." surname="Snell" fullname="J. Snell">
<organization/></author>
<date year="2010" month="March"/>
<abstract>
<t>Several applications extending the Hypertext Transfer Protocol (HTTP) require a feature to do partial resource modification.  The existing HTTP PUT method only allows a complete replacement of a document.  This proposal adds a new HTTP method, PATCH, to modify an existing HTTP resource. [STANDARDS-TRACK]</t></abstract></front>

<seriesInfo name="RFC" value="5789"/>
<format type="TXT" octets="21706" target="http://www.rfc-editor.org/rfc/rfc5789.txt"/>
</reference>

<!--
<reference anchor='RFC5785'>
<front>
<title>Defining Well-Known Uniform Resource Identifiers (URIs)</title>
<author initials='M.' surname='Nottingham' fullname='M. Nottingham'>
<organization /></author>
<author initials='E.' surname='Hammer-Lahav' fullname='E. Hammer-Lahav'>
<organization /></author>
<date year='2010' month='April' />
<abstract>
<t>This memo defines a path prefix for "well-known locations", "/.well-known/", in selected Uniform Resource Identifier (URI) schemes. [STANDARDS-TRACK]</t></abstract></front>
<seriesInfo name='RFC' value='5785' />
<format type='TXT' octets='13779' target='http://www.rfc-editor.org/rfc/rfc5785.txt' />
</reference>
-->

  <reference anchor='RFC5988'>
      <front>
        <title>Web Linking</title>
        <author initials='M.N.' surname='Nottingham' fullname='Mark Nottingham'>
          <organization/>
        </author>
        <date year='2010' month='October'/>
      </front>
      <seriesInfo name='RFC' value='5988'/>
  </reference>

  <reference anchor="RFC6020">
    <front>
      <title>YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)</title>
      <author initials="M." surname="Bjorklund" fullname="M. Bjorklund">
        <organization/>
      </author>
      <date year="2010" month="October"/>
      <abstract>
        <t>YANG is a data modeling language used to model configuration and state data manipulated by the Network Configuration Protocol (NETCONF), NETCONF remote procedure calls, and NETCONF notifications. [STANDARDS TRACK]</t>
      </abstract>
    </front>
    <seriesInfo name="RFC" value="6020"/>
    <format type="TXT" octets="324178" target="http://www.rfc-editor.org/rfc/rfc6020.txt"/>
  </reference>

<reference anchor="I-D.ietf-netmod-rfc6020bis">
  <front>
    <title>The YANG 1.1 Data Modeling Language</title>
    <author initials="M" surname="Bjorklund" fullname="Martin Bjorklund">
      <organization/>
    </author>
    <date month="September" day="23" year="2015"/>
    <abstract>
      <t>YANG is a data modeling language used to model configuration data, state data, remote procedure calls, and notifications for network management protocols like the Network Configuration Protocol (NETCONF).</t>
    </abstract>
  </front>
  <seriesInfo name="Internet-Draft" value="draft-ietf-netmod-rfc6020bis-07"/>
  <format type="TXT" target="http://www.ietf.org/internet-drafts/draft-ietf-netmod-rfc6020bis-07.txt"/>
</reference>


  <reference anchor='RFC6241'>
      <front>
        <title>Network Configuration Protocol (NETCONF)</title>
        <author initials='R.' surname='Enns' fullname='R. Enns' role="editor">
          <organization/>
        </author>
        <author initials='M.' surname='Bjorklund' fullname='M. Bjorklund' role="editor">
          <organization/>
        </author>
        <author initials='J.' surname='Schoenwaelder' fullname='J. Schoenwaelder' role="editor">
          <organization/>
        </author>
        <author initials='A.' surname='Bierman' fullname='A. Bierman' role="editor">
          <organization/>
        </author>
        <date year='2011' month='June'/>
      </front>
      <seriesInfo name='RFC' value='6241'/>
  </reference>


<reference anchor='RFC6243'>

<front>
<title>With-defaults Capability for NETCONF</title>
<author initials='A.' surname='Bierman' fullname='A. Bierman'>
<organization /></author>
<author initials='B.' surname='Lengyel' fullname='B. Lengyel'>
<organization /></author>
<date year='2011' month='June' />
<abstract>
<t>The Network Configuration Protocol (NETCONF) defines ways to read and edit configuration data from a NETCONF server.  In some cases, part of this data may not be set by the NETCONF client, but rather a default value known to the server is used instead.  In many situations the NETCONF client has a priori knowledge about default data, so the NETCONF server does not need to save it in a NETCONF configuration datastore or send it to the client in a retrieval operation reply.  In other situations the NETCONF client will need this data from the server.  Not all server implementations treat this default data the same way.  This document defines a capability-based extension to the NETCONF protocol that allows the NETCONF client to identify how defaults are processed by the server, and also defines new mechanisms for client control of server processing of default data. [STANDARDS-TRACK]</t></abstract></front>

<seriesInfo name='RFC' value='6243' />
<format type='TXT' octets='51568' target='http://www.rfc-editor.org/rfc/rfc6243.txt' />
</reference>

<reference anchor="RFC6536">
<front>
<title>Network Configuration Protocol (NETCONF) Access Control Model</title>
<author initials="A." surname="Bierman" fullname="A. Bierman">
<organization/></author>
<author initials="M." surname="Bjorklund" fullname="M. Bjorklund">
<organization/></author>
<date year="2012" month="March"/>
<abstract>
<t>The standardization of network configuration interfaces for use with the Network Configuration Protocol (NETCONF) requires a structured and secure operating environment that promotes human usability and multi-vendor interoperability.  There is a need for standard mechanisms to restrict NETCONF protocol access for particular users to a pre-configured subset of all available NETCONF protocol operations and content.  This document defines such an access control model. [STANDARDS-TRACK]</t></abstract></front>
<seriesInfo name="RFC" value="6536"/>
<format type="TXT" octets="90803" target="http://www.rfc-editor.org/rfc/rfc6536.txt"/>
</reference>


  <reference anchor='RFC6570'>
      <front>
        <title>URI Template</title>
        <author initials='J.G.' surname='Gregorio' fullname='Joe Gregorio'>
          <organization>Google</organization>
        </author>
        <author initials='R.F.' surname='Fielding' fullname='Roy Fielding'>
          <organization>Adobe</organization>
        </author>
        <author initials='M.H.' surname='Hadley' fullname='Marc Hadley'>
          <organization>MITRE</organization>
        </author>
        <author initials='M.N.' surname='Nottingham' fullname='Mark Nottingham'>
          <organization>Rackspace</organization>
        </author>
        <author initials='D.O.' surname='Orchard' fullname='David Orchard'>
          <organization>Salesforce.com</organization>
        </author>
        <date year='2012' month='March'/>
      </front>
      <seriesInfo name='RFC' value='6570'/>
  </reference>

  <reference anchor="I-D.ietf-netmod-yang-json">
    <front>
      <title>JSON Encoding of Data Modeled with YANG</title>
      <author initials="L." surname="Lhotka" fullname="L. Lhotka">
        <organization>CZ.NIC</organization>
      </author>
      <date year="2015" month="October"/>
    </front>
    <seriesInfo name="Internet-Draft"
                value="draft-ietf-netmod-yang-json-06"/>
    <format type='TXT'
    target='http://www.ietf.org/id/draft-ietf-netmod-yang-json-06.txt'/>
  </reference>


  <reference anchor="I-D.ietf-netmod-yang-metadata">
    <front>
      <title>Defining and Using Metadata with YANG</title>
      <author initials="L." surname="Lhotka" fullname="L. Lhotka">
        <organization>CZ.NIC</organization>
      </author>
      <date year="2015" month="September"/>
    </front>
    <seriesInfo name="Internet-Draft"
                value="draft-ietf-netmod-yang-metadata-02"/>
    <format type='TXT'
    target='http://www.ietf.org/id/draft-ietf-netmod-yang-metadata-02.txt'/>
  </reference>

<reference anchor="RFC6415">
<front>
<title>Web Host Metadata</title>
<author initials='E.' surname='Hammer-Lahav' fullname='Eran Hammer-Lahav'><organization /></author>
<author initials='B.C.' surname='Cook' fullname='Blaine Cook'><organization /></author>
<date year='2011' month='October' />
</front>
<seriesInfo name='RFC' value='6415' />
<format type='TXT' octets='32018' target='http://www.rfc-editor.org/rfc/rfc6415.txt' />
</reference>


<reference anchor='RFC6991'>

<front>
<title>Common YANG Data Types</title>
<author initials='J.' surname='Schoenwaelder' fullname='J. Schoenwaelder'>
<organization /></author>
<date year='2013' month='July' />
<abstract>
<t>This document introduces a collection of common data types to be used with the YANG data modeling language.  This document obsoletes RFC 6021.</t></abstract></front>

<seriesInfo name='RFC' value='6991' />
<format type='TXT' octets='60242' target='http://www.rfc-editor.org/rfc/rfc6991.txt' />
</reference>

<reference anchor="W3C.CR-eventsource-20121211"
           target="http://www.w3.org/TR/2012/CR-eventsource-20121211">
  <front>
    <title>Server-Sent Events</title>
    <author initials="I." surname="Hickson" fullname="Ian Hickson">
      <organization/></author><date month="December" day="11" year="2012"/>
  </front>
  <seriesInfo name="World Wide Web Consortium CR"
              value="CR-eventsource-20121211"/>
  <format type="HTML"
          target="http://www.w3.org/TR/2012/CR-eventsource-20121211"/>
</reference>

<reference anchor='W3C.REC-xml-20081126'
           target='http://www.w3.org/TR/2008/REC-xml-20081126'>
<front>
<title>Extensible Markup Language (XML) 1.0 (Fifth Edition)</title>

<author initials='F.' surname='Yergeau' fullname='François Yergeau'>
    <organization />
</author>

<author initials='E.' surname='Maler' fullname='Eve Maler'>
    <organization />
</author>

<author initials='J.' surname='Paoli' fullname='Jean Paoli'>
    <organization />
</author>

<author initials='C.' surname='Sperberg-McQueen' fullname='C. M. Sperberg-McQueen'>
    <organization />
</author>

<author initials='T.' surname='Bray' fullname='Tim Bray'>
    <organization />
</author>

<date month='November' day='26' year='2008' />
</front>

<seriesInfo name='World Wide Web Consortium Recommendation' value='REC-xml-20081126' />
<format type='HTML' target='http://www.w3.org/TR/2008/REC-xml-20081126' />
</reference>

<reference anchor="RFC7158">
      <front>
        <title>The JSON Data Interchange Format</title>
        <author initials="T." surname="Bray"
                fullname="T. Bray" role="editor">
          <organization />
        </author>
        <date month="March" year="2013" />
      </front>
      <seriesInfo name='RFC' value='7158' />
     <format type='TXT' target='http://www.rfc-editor.org/rfc/rfc7158.txt' />
</reference>


<reference anchor="RFC7320">
<front>
<title>URI Design and Ownership</title>
<author initials="M." surname="Nottingham" fullname="M. Nottingham">
<organization/>
</author>
<date year="2014" month="July"/>
<abstract>
<t>
Section 1.1.1 of RFC 3986 defines URI syntax as "a federated and extensible naming system wherein each scheme's specification may further restrict the syntax and semantics of identifiers using that scheme." In other words, the structure of a URI is defined by its scheme. While it is common for schemes to further delegate their substructure to the URI's owner, publishing independent standards that mandate particular forms of URI substructure is inappropriate, because that essentially usurps ownership. This document further describes this problematic practice and provides some acceptable alternatives for use in standards.
</t>
</abstract>
</front>
<seriesInfo name="BCP" value="190"/>
<seriesInfo name="RFC" value="7320"/>
<format type="TXT" octets="18275" target="http://www.rfc-editor.org/rfc/rfc7320.txt"/>
</reference>



<reference  anchor='RFC7589' target='http://www.rfc-editor.org/info/rfc7589'>
<front>
<title>Using the NETCONF Protocol over Transport Layer Security (TLS) with Mutual X.509 Authentication</title>
<author initials='M.' surname='Badra' fullname='M. Badra'><organization /></author>
<author initials='A.' surname='Luchuk' fullname='A. Luchuk'><organization /></author>
<author initials='J.' surname='Schoenwaelder' fullname='J. Schoenwaelder'><organization /></author>
<date year='2015' month='June' />
<abstract><t>The Network Configuration Protocol (NETCONF) provides mechanisms to install, manipulate, and delete the configuration of network devices. This document describes how to use the Transport Layer Security (TLS) protocol with mutual X.509 authentication to secure the exchange of NETCONF messages.  This revision of RFC 5539 documents the new message framing used by NETCONF 1.1 and it obsoletes RFC 5539.</t></abstract>
</front>
<seriesInfo name='RFC' value='7589'/>
<seriesInfo name='DOI' value='10.17487/RFC7589'/>
</reference>

  <reference anchor="I-D.ietf-netconf-yang-library">
      <front>
        <title>YANG Module Library</title>
        <author initials="A.B." surname="Bierman" fullname="Andy Bierman">
          <organization />
        </author>
        <author initials="M.B." surname="Bjorklund" fullname="Martin Bjorklund">
          <organization />
        </author>
        <author initials="K.W." surname="Watsen" fullname="Kent Watsen">
          <organization />
        </author>
        <date year="2015" month="July"/>
      </front>
      <seriesInfo name="Internet-Draft" value="draft-ietf-netconf-yang-library-01" />
      <format type="TXT" target="https://tools.ietf.org/html/draft-ietf-netconf-yang-library-01"/>
</reference>

<reference anchor="XPath" target="http://www.w3.org/TR/1999/REC-xpath-19991116">
      <front>
        <title>XML Path Language (XPath) Version 1.0</title>
        <author initials="J." surname="Clark" fullname="James Clark">
          <organization/>
        </author>
        <author initials="S." surname="DeRose" fullname="Steven DeRose">
          <organization/>
        </author>
        <date month="November" day="16" year="1999"/>
      </front>
      <seriesInfo name="World Wide Web Consortium Recommendation" value="REC-xpath-19991116"/>
      <format type="HTML" target="http://www.w3.org/TR/1999/REC-xpath-19991116"/>
</reference>


</references>

<references title="Informative References">

  <reference anchor='rest-dissertation'>
      <front>
        <title>Architectural Styles and
the Design of Network-based Software Architectures</title>
        <author initials='R.F.' surname='Fielding' fullname='Roy Fielding'>
          <organization>University of California, Irvine</organization>
        </author>
        <date year='2000'/>
      </front>
  </reference>


  <reference anchor="I-D.ietf-netconf-yang-patch">
      <front>
        <title>YANG Patch Media Type</title>
        <author initials="A.B." surname="Bierman" fullname="Andy Bierman">
          <organization />
        </author>
        <author initials="M.B." surname="Bjorklund" fullname="Martin Bjorklund">
          <organization />
        </author>
        <author initials="K.W." surname="Watsen" fullname="Kent Watsen">
          <organization />
        </author>
        <date year="2015" month="October"/>
      </front>
      <seriesInfo name="Internet-Draft" value="draft-ietf-netconf-yang-patch-06" />
      <format type="TXT" target="https://tools.ietf.org/html/draft-ietf-netconf-yang-patch-06"/>
</reference>


</references>
<section title="Change Log" anchor="change-log">
	<figure>
	    <artwork><![CDATA[
    -- RFC Ed.: remove this section before publication.
	    ]]></artwork>
	</figure>
    <t>
The RESTCONF issue tracker can be found here:
https://github.com/netconf-wg/restconf/issues
    </t>
<section title="v08 - v09" anchor="v08---v09">
<t>
 <list style="symbols">
 <t>
fix introduction text regarding implementation requirements
for the ietf-yang-library
 </t>
 <t>
clarified HTTP authentication requirements
 </t>
 <t>
fix host-meta example
 </t>
 <t>
changed list key encoding to clarify that quoted strings are not allowed.
Percent-encoded values are used if quotes would be required. A missing
key is treated as a zero-length string
 </t>
 <t>
Fixed example of percent-encoded string to match YANG model
 </t>
 <t>
Changed streams examples to align with naming already used
 </t>
 </list>
</t>
</section>
<section title="v07 - v08" anchor="v07---v08">
<t>
 <list style="symbols">
 <t>
add support for YANG 1.1 action statement
 </t>
 <t>
changed mandatory encoding from XML to XML or JSON
 </t>
 <t>
fix syntax in fields parameter definition
 </t>
 <t>
add meta-data encoding examples for XML and JSON
 </t>
 <t>
remove RFC 2396 references and update with 3986
 </t>
 <t>
change encoding of a key so quoted string are not used, since
they are already percent-encoded. A zero-length string is
not encoded (/list=foo,,baz)
 </t>
 <t>
Add example of percent-encoded key value
 </t>
 </list>
</t>
</section>
<section title="v06 - v07" anchor="v06---v07">
<t>
 <list style="symbols">
 <t>
fixed all issues identified in email from Jernej Tuljak
in netconf email 2015-06-22
 </t>
 <t>
fixed error example bug where error-urlpath was still used.
Changed to error-path.
 </t>
 <t>
added mention of YANG Patch and informative reference
 </t>
 <t>
added support for YANG 1.1, specifically support for anydata and
actions
 </t>
 <t>
removed the special field value &quot;*&quot;, since it is no longer needed
 </t>
 </list>
</t>
</section>
<section title="v05 - v06" anchor="v05---v06">
<t>
 <list style="symbols">
 <t>
fixed RESTCONF issue #23  (ietf-restconf-monitoring bug)
 </t>
 </list>
</t>
</section>
<section title="v04 - v05" anchor="v04---v05">
<t>
 <list style="symbols">
 <t>
changed term &apos;notification event&apos; to &apos;event notification&apos;
 </t>
 <t>
removed intro text about framework and meta-model
 </t>
 <t>
removed early mention of API resources
 </t>
 <t>
removed term unified datastore and cleaned up text about NETCONF datastores
 </t>
 <t>
removed text about not immediate persistence of edits
 </t>
 <t>
removed RESTCONF-specific data-resource-identifier typedef and its usage
 </t>
 <t>
clarified encoding of key leafs
 </t>
 <t>
changed several examples from JSON to XML encoding
 </t>
 <t>
made &apos;insert&apos; and &apos;point&apos; query parameters mandatory to implement
 </t>
 <t>
removed &quot;:insert&quot; capability URI
 </t>
 <t>
renamed stream/encoding to stream/access
 </t>
 <t>
renamed stream/encoding/type to stream/access/encoding
 </t>
 <t>
renamed stream/encoding/events to stream/access/location
 </t>
 <t>
changed XPath from informative to normative reference
 </t>
 <t>
changed rest-dissertation from normative to informative reference
 </t>
 <t>
changed example-jukebox playlist &apos;id&apos; from a data-resource-identifier
to a leafref pointing at the song name
 </t>
 </list>
</t>
</section>
<section title="v03 - v04" anchor="v03---v04">
<t>
 <list style="symbols">
 <t>
renamed &apos;select&apos; to &apos;fields&apos; (#1)
 </t>
 <t>
moved collection resource and page capability
to draft-ietf-netconf-restconf-collection-00 (#3)
 </t>
 <t>
added mandatory &quot;defaults&quot; protocol capability URI (#4)
 </t>
 <t>
added optional &quot;with&#8209;defaults&quot; query parameter URI (#4)
 </t>
 <t>
clarified authentication procedure (#9)
 </t>
 <t>
moved ietf-yang-library module to draft-ietf-netconf-yang-library-00 (#13)
 </t>
 <t>
clarified that JSON encoding of module name in a URI
MUST follow the netmod-yang-json encoding rules (#14)
 </t>
 <t>
added restconf-media-type extension (#15)
 </t>
 <t>
remove &quot;content&quot; query parameter URI and made this
parameter mandatory (#16)
 </t>
 <t>
clarified datastore usage
 </t>
 <t>
changed lock-denied error example
 </t>
 <t>
added with-defaults query parameter example
 </t>
 <t>
added term &quot;RESTCONF Capability&quot;
 </t>
 <t>
changed NETCONF Capability URI registry usage to new
RESTCONF Capability URI Registry usage
 </t>
 </list>
</t>
</section>
<section title="v02 - v03" anchor="v02---v03">
<t>
 <list style="symbols">
 <t>
added collection resource
 </t>
 <t>
added &quot;page&quot; query parameter capability
 </t>
 <t>
added &quot;limit&quot; and &quot;offset&quot; query parameters, which are available if
the &quot;page&quot; capability is supported
 </t>
 <t>
added &quot;stream list&quot; term
 </t>
 <t>
fixed bugs in some examples
 </t>
 <t>
added &quot;encoding&quot; list within the &quot;stream&quot; list to allow
different &lt;events&gt; URLs for XML and JSON encoding.
 </t>
 <t>
made XML MUST implement and JSON MAY implement for servers
 </t>
 <t>
re-add JSON notification examples (previously removed)
 </t>
 <t>
updated JSON references
 </t>
 </list>
</t>
</section>
<section title="v01 - v02" anchor="v01---v02">
<t>
 <list style="symbols">
 <t>
moved query parameter definitions from the YANG module
back to the plain text sections
 </t>
 <t>
made all query parameters optional to implement
 </t>
 <t>
defined query parameter capability URI
 </t>
 <t>
moved &apos;streams&apos; to new YANG module (ietf-restconf-monitoring)
 </t>
 <t>
added &apos;capabilities&apos; container to new YANG module (ietf-restconf-monitoring)
 </t>
 <t>
moved &apos;modules&apos; container to new YANG module (ietf-yang-library)
 </t>
 <t>
added new leaf &apos;module&#8209;set&#8209;id&apos; (ietf-yang-library)
 </t>
 <t>
added new leaf &apos;conformance&apos; (ietf-yang-library)
 </t>
 <t>
changed &apos;schema&apos; leaf to type inet:uri that returns the location
of the YANG schema (instead of returning the schema directly)
 </t>
 <t>
changed &apos;events&apos; leaf to type inet:uri that returns the location
of the event stream resource (instead of returning events directly)
 </t>
 <t>
changed examples for yang.api resource since the monitoring information
is no longer in this resource
 </t>
 <t>
closed issue #1 &apos;select parameter&apos; since no objections to the proposed
syntax
 </t>
 <t>
closed &quot;encoding of list keys&quot; issue since no objection to new encoding
of list keys in a target resource URI.
 </t>
 <t>
moved open issues list to the issue tracker on github
 </t>
 </list>
</t>
</section>
<section title="v00 - v01" anchor="v00---v01">
<t>
 <list style="symbols">
 <t>
fixed content=nonconfig example (non-config was incorrect)
 </t>
 <t>
closed open issue &apos;message&#8209;id&apos;.  There is no need for a message-id
field, and RFC 2392 does not apply.
 </t>
 <t>
closed open issue &apos;server support verification&apos;. The headers used
by RESTCONF are widely supported.
 </t>
 <t>
removed encoding rules from section on RESTCONF Meta-Data. This is now
defined in &quot;I&#8209;D.lhotka&#8209;netmod&#8209;yang&#8209;json&quot;.
 </t>
 <t>
added media type application/yang.errors to map to errors YANG grouping.
Updated error examples to use new media type.
 </t>
 <t>
closed open issue &apos;additional datastores&apos;. Support may be added in the
future to identify new datastores.
 </t>
 <t>
closed open issue &apos;PATCH media type discovery&apos;. The section
on PATCH has an added sentence on the Accept-Patch header.
 </t>
 <t>
closed open issue &apos;YANG to resource mapping&apos;. Current mapping
of all data nodes to resources will be used in order to allow
mandatory DELETE support. The PATCH operation is optional,
as well as the YANG Patch media type.
 </t>
 <t>
closed open issue &apos;_self links for HATEOAS support&apos;. It was decided
that they are redundant because they can be derived from the YANG module
for the specific data.
 </t>
 <t>
added explanatory text for the &apos;select&apos; parameter.
 </t>
 <t>
added RESTCONF Path Resolution section for discovering the
root of the RESTCONF API using the /.well-known/host-meta.
 </t>
 <t>
added an &quot;error&quot; media type to for structured error messages
 </t>
 <t>
added Secure Transport section requiring TLS
 </t>
 <t>
added Security Considerations section
 </t>
 <t>
removed all references to &quot;REST&#8209;like&quot;
 </t>
 </list>
</t>
</section>
<section title="bierman:restconf-04 to ietf:restconf-00" anchor="biermanrestconf-04-to-ietfrestconf-00">
<t>
 <list style="symbols">
 <t>
updated open issues section
 </t>
 </list>
</t>
</section>
</section>
<section title="Open Issues" anchor="open-issues">
	<figure>
	    <artwork><![CDATA[
    -- RFC Ed.: remove this section before publication.
	    ]]></artwork>
	</figure>
    <t>
The RESTCONF issues are tracked on github.com:
    </t>

<t>   <eref target="https://github.com/netconf-wg/restconf/issues">https://github.com/netconf-wg/restconf/issues</eref></t>
</section>
<section title="Example YANG Module" anchor="example-yang-module">
    <t>
The example YANG module used in this document represents
a simple media jukebox interface.
    </t>
    <t>
YANG Tree Diagram for &quot;example&#8209;jukebox&quot; Module
    </t>
	<figure>
	    <artwork><![CDATA[
   +--rw jukebox!
      +--rw library
      |  +--rw artist* [name]
      |  |  +--rw name     string
      |  |  +--rw album* [name]
      |  |     +--rw name     string
      |  |     +--rw genre?   identityref
      |  |     +--rw year?    uint16
      |  |     +--rw admin
      |  |     |  +--rw label?              string
      |  |     |  +--rw catalogue-number?   string
      |  |     +--rw song* [name]
      |  |        +--rw name        string
      |  |        +--rw location    string
      |  |        +--rw format?     string
      |  |        +--rw length?     uint32
      |  +--ro artist-count?   uint32
      |  +--ro album-count?    uint32
      |  +--ro song-count?     uint32
      +--rw playlist* [name]
      |  +--rw name           string
      |  +--rw description?   string
      |  +--rw song* [index]
      |     +--rw index    uint32
      |     +--rw id       leafref
      +--rw player
         +--rw gap?   decimal64
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
  rpcs:
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
   +---x play
      +--ro input
         +--ro playlist       string
         +--ro song-number    uint32
	    ]]></artwork>
	</figure>
<section title="example-jukebox YANG Module" anchor="example-module">
	<figure>
	    <artwork><![CDATA[
module example-jukebox {

   namespace "http://example.com/ns/example-jukebox";
   prefix "jbox";

   organization "Example, Inc.";
   contact "support at example.com";
   description "Example Jukebox Data Model Module";
   revision "2015-04-04" {
     description "Initial version.";
     reference "example.com document 1-4673";
   }

   identity genre {
     description "Base for all genre types";
   }

   // abbreviated list of genre classifications
   identity alternative {
     base genre;
     description "Alternative music";
   }
   identity blues {
     base genre;
     description "Blues music";
   }
   identity country {
     base genre;
     description "Country music";
   }
   identity jazz {
     base genre;
     description "Jazz music";
   }
   identity pop {
     base genre;
     description "Pop music";
   }
   identity rock {
     base genre;
     description "Rock music";
   }

   container jukebox {
     presence
       "An empty container indicates that the jukebox
        service is available";

     description
       "Represents a jukebox resource, with a library, playlists,
        and a play operation.";

     container library {

       description "Represents the jukebox library resource.";

       list artist {
         key name;

         description
           "Represents one artist resource within the
            jukebox library resource.";

         leaf name {
           type string {
             length "1 .. max";
           }
           description "The name of the artist.";
         }

         list album {
           key name;

           description
             "Represents one album resource within one
              artist resource, within the jukebox library.";

           leaf name {
             type string {
               length "1 .. max";
             }
             description "The name of the album.";
           }

           leaf genre {
             type identityref { base genre; }
             description
               "The genre identifying the type of music on
                the album.";
           }

           leaf year {
             type uint16 {
               range "1900 .. max";
             }
             description "The year the album was released";
           }

           container admin {
             description
               "Administrative information for the album.";

             leaf label {
               type string;
               description "The label that released the album.";
             }
             leaf catalogue-number {
               type string;
               description "The album's catalogue number.";
             }
           }

           list song {
             key name;

             description
               "Represents one song resource within one
                album resource, within the jukebox library.";

             leaf name {
               type string {
                  length "1 .. max";
               }
               description "The name of the song";
             }
             leaf location {
               type string;
               mandatory true;
               description
                "The file location string of the
                 media file for the song";
             }
             leaf format {
               type string;
               description
                 "An identifier string for the media type
                  for the file associated with the
                  'location' leaf for this entry.";
             }
             leaf length {
               type uint32;
               units "seconds";
               description
                 "The duration of this song in seconds.";
             }
           }   // end list 'song'
         }   // end list 'album'
       }  // end list 'artist'

       leaf artist-count {
          type uint32;
          units "songs";
          config false;
          description "Number of artists in the library";
       }
       leaf album-count {
          type uint32;
          units "albums";
          config false;
          description "Number of albums in the library";
       }
       leaf song-count {
          type uint32;
          units "songs";
          config false;
          description "Number of songs in the library";
       }
     }  // end library

     list playlist {
       key name;

       description
         "Example configuration data resource";

       leaf name {
         type string;
         description
           "The name of the playlist.";
       }
       leaf description {
         type string;
         description
           "A comment describing the playlist.";
       }
       list song {
         key index;
         ordered-by user;

         description
           "Example nested configuration data resource";

         leaf index {    // not really needed
           type uint32;
           description
             "An arbitrary integer index for this playlist song.";
         }
         leaf id {
           type leafref {
             path "/jbox:jukebox/jbox:library/jbox:artist/" +
                  "jbox:album/jbox:song/jbox:name";
           }
           mandatory true;
           description
             "Song identifier. Must identify an instance of
              /jukebox/library/artist/album/song/name.";
         }
       }
     }

     container player {
       description
         "Represents the jukebox player resource.";

       leaf gap {
         type decimal64 {
           fraction-digits 1;
           range "0.0 .. 2.0";
         }
         units "tenths of seconds";
         description "Time gap between each song";
       }
     }
   }

   rpc play {
     description "Control function for the jukebox player";
     input {
       leaf playlist {
         type string;
         mandatory true;
         description "playlist name";
       }
       leaf song-number {
         type uint32;
         mandatory true;
         description "Song number in playlist to play";
       }
     }
   }
}

	    ]]></artwork>
	</figure>
</section>
</section>
<section title="RESTCONF Message Examples" anchor="main-examples">
    <t>
The examples within this document use the normative
YANG module defined in <xref target="module"/> and the non-normative
example YANG module defined in <xref target="example-module"/>.
    </t>
    <t>
This section shows some typical RESTCONF message exchanges.
    </t>
<section title="Resource Retrieval Examples" anchor="resource-retrieval-examples">
<section title="Retrieve the Top-level API Resource" anchor="retrieve-the-top-level-api-resource">
    <t>
The client may start by retrieving the top-level
API resource, using the entry point URI &quot;{+restconf}&quot;.
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf   HTTP/1.1
   Host: example.com
   Accept: application/yang.api+json
	    ]]></artwork>
	</figure>
    <t>
The server might respond as follows:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:01:00 GMT
   Server: example-server
   Content-Type: application/yang.api+json

   {
     "ietf-restconf:restconf": {
       "data" : [ null ],
       "operations" : [ null ]
     }
   }
	    ]]></artwork>
	</figure>
    <t>
To request that the response content to be encoded in XML,
the &quot;Accept&quot; header can be used, as in this example request:
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf HTTP/1.1
   Host: example.com
   Accept: application/yang.api+xml
	    ]]></artwork>
	</figure>
    <t>
The server will return the same response either way,
which might be as follows :
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:01:00 GMT
   Server: example-server
   Cache-Control: no-cache
   Pragma: no-cache
   Content-Type: application/yang.api+xml
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
   <restconf xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
     <data/>
     <operations/>
   </restconf>
	    ]]></artwork>
	</figure>
</section>
<section title="Retrieve The Server Module Information" anchor="retrieve-the-server-module-information">
    <t>
In this example the client is retrieving the modules information
from the server in JSON format:
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/ietf-yang-library:modules HTTP/1.1
   Host: example.com
   Accept: application/yang.data+json
	    ]]></artwork>
	</figure>
    <t>
The server might respond as follows.
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:01:00 GMT
   Server: example-server
   Cache-Control: no-cache
   Pragma: no-cache
   Last-Modified: Sun, 22 Apr 2012 01:00:14 GMT
   Content-Type: application/yang.data+json

   {
     "ietf-yang-library:modules": {
       "module": [
         {
           "name" : "foo",
           "revision" : "2012-01-02",
           "schema" : "https://example.com/modules/foo/2012-01-02",
           "namespace" : "http://example.com/ns/foo",
           "feature" : [ "feature1", "feature2" ],
           "conformance" : "implement"
         },
         {
           "name" : "foo-types",
           "revision" : "2012-01-05",
           "schema" :
             "https://example.com/modules/foo-types/2012-01-05",
           "schema" : [null],
           "namespace" : "http://example.com/ns/foo-types",
           "conformance" : "import"
         },
         {
           "name" : "bar",
           "revision" : "2012-11-05",
           "schema" : "https://example.com/modules/bar/2012-11-05",
           "namespace" : "http://example.com/ns/bar",
           "feature" : [ "bar-ext" ],
           "conformance" : "implement",
           "submodule" : [
             {
               "name" : "bar-submod1",
               "revision" : "2012-11-05",
               "schema" :
                "https://example.com/modules/bar-submod1/2012-11-05"
             },
             {
               "name" : "bar-submod2",
               "revision" : "2012-11-05",
               "schema" :
                "https://example.com/modules/bar-submod2/2012-11-05"
             }
           ]
         }
       ]
     }
   }
	    ]]></artwork>
	</figure>
</section>
<section title="Retrieve The Server Capability Information" anchor="retrieve-the-server-capability-information">
    <t>
In this example the client is retrieving the capability information
from the server in JSON format, and the server supports all
the RESTCONF query parameters, plus one vendor parameter:
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/ietf-restconf-monitoring:restconf-state/
       capabilities  HTTP/1.1
   Host: example.com
   Accept: application/yang.data+xml
	    ]]></artwork>
	</figure>
    <t>
The server might respond as follows.
The extra whitespace in &apos;capability&apos; elements
for display purposes only.
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:02:00 GMT
   Server: example-server
   Cache-Control: no-cache
   Pragma: no-cache
   Last-Modified: Sun, 22 Apr 2012 01:00:14 GMT
   Content-Type: application/yang.data+xml
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
   <capabilities xmlns="">
    <capability>
     urn:ietf:params:restconf:capability:depth:1.0
    </capability>
    <capability>
     urn:ietf:params:restconf:capability:fields:1.0
    </capability>
    <capability>
     urn:ietf:params:restconf:capability:filter:1.0
    </capability>
    <capability>
     urn:ietf:params:restconf:capability:start-time:1.0
    </capability>
    <capability>
     urn:ietf:params:restconf:capability:stop-time:1.0
    </capability>
    <capability>
     http://example.com/capabilities/myparam
    </capability>
   </capabilities>
	    ]]></artwork>
	</figure>
</section>
</section>
<section title="Edit Resource Examples" anchor="edit-resource-examples">
<section title="Create New Data Resources" anchor="ex-create">
    <t>
To create a new &quot;artist&quot; resource within the &quot;library&quot;
resource, the client might send the following request.
    </t>
	<figure>
	    <artwork><![CDATA[
   POST /restconf/data/example-jukebox:jukebox/library HTTP/1.1
   Host: example.com
   Content-Type: application/yang.data+json

   {
     "example-jukebox:artist" : {
       "name" : "Foo Fighters"
     }
   }
	    ]]></artwork>
	</figure>
    <t>
If the resource is created, the server might respond as follows.
Note that the &quot;Location&quot; header line is wrapped
for display purposes only:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 201 Created
   Date: Mon, 23 Apr 2012 17:02:00 GMT
   Server: example-server
   Location: https://example.com/restconf/data/
       example-jukebox:jukebox/library/artist=Foo%20Fighters
   Last-Modified: Mon, 23 Apr 2012 17:02:00 GMT
   ETag: b3830f23a4c
	    ]]></artwork>
	</figure>
    <t>
To create a new &quot;album&quot; resource for this artist within the &quot;jukebox&quot;
resource, the client might send the following request.
Note that the request URI header line is wrapped
for display purposes only:
    </t>
	<figure>
	    <artwork><![CDATA[
   POST /restconf/data/example-jukebox:jukebox/
       library/artist=Foo%20Fighters  HTTP/1.1
   Host: example.com
   Content-Type: application/yang.data+json

   {
     "example-jukebox:album" : {
       "name" : "Wasting Light",
       "genre" : "example-jukebox:alternative",
       "year" : 2012    # note this is the wrong date
     }
   }
	    ]]></artwork>
	</figure>
    <t>
If the resource is created, the server might respond
as follows.  Note that the &quot;Location&quot; header line is wrapped
for display purposes only:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 201 Created
   Date: Mon, 23 Apr 2012 17:03:00 GMT
   Server: example-server
   Location: https://example.com/restconf/data/
       example-jukebox:jukebox/library/artist=Foo%20Fighters/
       album=Wasting%20Light
   Last-Modified: Mon, 23 Apr 2012 17:03:00 GMT
   ETag: b8389233a4c
	    ]]></artwork>
	</figure>
</section>
<section title="Detect Resource Entity Tag Change" anchor="detect-resource-entity-tag-change">
    <t>
In this example, the server just supports the
mandatory datastore last-changed timestamp.
The client has previously retrieved the &quot;Last&#8209;Modified&quot;
header and has some value cached to provide in
the following request to patch an &quot;album&quot; list entry
with key value &quot;Wasting Light&quot;. Only the &quot;year&quot; field is being
updated.
    </t>
	<figure>
	    <artwork><![CDATA[
   PATCH /restconf/data/example-jukebox:jukebox/
       library/artist=Foo%20Fighters/album=Wasting%20Light/year
       HTTP/1.1
   Host: example.com
   If-Unmodified-Since: Mon, 23 Apr 2012 17:01:00 GMT
   Content-Type: application/yang.data+json

   { "example-jukebox:year" : "2011" }
	    ]]></artwork>
	</figure>
    <t>
In this example the datastore resource has changed
since the time specified in the &quot;If&#8209;Unmodified&#8209;Since&quot;
header.  The server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 412 Precondition Failed
   Date: Mon, 23 Apr 2012 19:01:00 GMT
   Server: example-server
   Last-Modified: Mon, 23 Apr 2012 17:45:00 GMT
   ETag: b34aed893a4c
	    ]]></artwork>
	</figure>
</section>
<section title="Edit a Datastore Resource" anchor="edit-a-datastore-resource">
    <t>
In this example, the client modifies two different data nodes by
sending a PATCH to the datastore resource:
    </t>
	<figure>
	    <artwork><![CDATA[
   PATCH /restconf/data HTTP/1.1
   Host: example.com
   Content-Type: application/yang.datastore+xml
	    ]]></artwork>
	</figure>
	<figure>
	    <artwork><![CDATA[
   <data xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
     <jukebox xmlns="http://example.com/ns/example-jukebox">
       <library>
         <artist>
           <name>Foo Fighters</name>
           <album>
             <name>Wasting Light</name>
             <year>2011</year>
           </album>
         </artist>
         <artist>
           <name>Nick Cave</name>
           <album>
             <name>Tender Prey</name>
             <year>1988</year>
           </album>
         </artist>
       </library>
     </jukebox>
   </data>
	    ]]></artwork>
	</figure>
</section>
</section>
<section title="Query Parameter Examples" anchor="ex-query">
<section title="&quot;content&quot; Parameter" anchor="content-parameter">
    <t>
The &quot;content&quot; parameter is used to select the type of
data child resources (configuration and/or not configuration)
that are returned by the server for a GET method request.
    </t>
    <t>
In this example, a simple YANG list that has configuration
and non-configuration child resources.
    </t>
	<figure>
	    <artwork><![CDATA[
  container events
    list event {
      key name;
      leaf name { type string; }
      leaf description { type string; }
      leaf event-count {
        type uint32;
        config false;
      }
    }
  }
	    ]]></artwork>
	</figure>
    <t>
Example 1: content=all
    </t>
    <t>
To retrieve all the child resources, the &quot;content&quot; parameter
is set to &quot;all&quot;. The client might send:
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/example-events:events?content=all
       HTTP/1.1
   Host: example.com
   Accept: application/yang.data+json
	    ]]></artwork>
	</figure>
    <t>
The server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:11:30 GMT
   Server: example-server
   Cache-Control: no-cache
   Pragma: no-cache
   Content-Type: application/yang.data+json

   {
     "example-events:events" : {
       "event" : [
         {
           "name" : "interface-up",
           "description" : "Interface up notification count",
           "event-count" : 42
         },
         {
           "name" : "interface-down",
           "description" : "Interface down notification count",
           "event-count" : 4
         }
       ]
     }
   }
	    ]]></artwork>
	</figure>
    <t>
Example 2: content=config
    </t>
    <t>
To retrieve only the configuration child resources,
the &quot;content&quot; parameter is set to &quot;config&quot; or omitted
since this is the default value.  Note that the &quot;ETag&quot;
and &quot;Last&#8209;Modified&quot; headers are only returned if
the content parameter value is &quot;config&quot;.
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/example-events:events?content=config
       HTTP/1.1
   Host: example.com
   Accept: application/yang.data+json
	    ]]></artwork>
	</figure>
    <t>
The server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:11:30 GMT
   Server: example-server
   Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT
   ETag: eeeada438af
   Cache-Control: no-cache
   Pragma: no-cache
   Content-Type: application/yang.data+json

   {
     "example-events:events" : {
       "event" : [
         {
           "name" : "interface-up",
           "description" : "Interface up notification count"
         },
         {
           "name" : "interface-down",
           "description" : "Interface down notification count"
         }
       ]
     }
   }
	    ]]></artwork>
	</figure>
    <t>
Example 3: content=nonconfig
    </t>
    <t>
To retrieve only the non-configuration child resources,
the &quot;content&quot; parameter is set to &quot;nonconfig&quot;. Note
that configuration ancestors (if any) and list key leafs
(if any) are also returned.  The client might send:
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/example-events:events?content=nonconfig
       HTTP/1.1
   Host: example.com
   Accept: application/yang.data+json
	    ]]></artwork>
	</figure>
    <t>
The server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:11:30 GMT
   Server: example-server
   Cache-Control: no-cache
   Pragma: no-cache
   Content-Type: application/yang.data+json

   {
     "example-events:events" : {
       "event" : [
         {
           "name" : "interface-up",
           "event-count" : 42
         },
         {
           "name" : "interface-down",
           "event-count" : 4
         }
       ]
     }
   }
	    ]]></artwork>
	</figure>
</section>
<section title="&quot;depth&quot; Parameter" anchor="depth-parameter">
    <t>
The &quot;depth&quot; parameter is used to limit the number of levels
of child resources that are returned by the server for
a GET method request.
    </t>
    <t>
The depth parameter starts counting levels at the
level of the target resource that is specified,
so that a depth level of &quot;1&quot; includes just the target resource
level itself. A depth level of &quot;2&quot; includes the target resource
level and its child nodes.
    </t>
    <t>
This example shows how different values of the &quot;depth&quot;
parameter would affect the reply content for
retrieval of the top-level &quot;jukebox&quot; data resource.
    </t>
    <t>
Example 1: depth=unbounded
    </t>
    <t>
To retrieve all the child resources, the &quot;depth&quot; parameter
is not present or set to the default value &quot;unbounded&quot;.
Note that some strings are wrapped for display purposes only.
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/example-jukebox:jukebox?depth=unbounded
       HTTP/1.1
   Host: example.com
   Accept: application/yang.data+json
	    ]]></artwork>
	</figure>
    <t>
The server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:11:30 GMT
   Server: example-server
   Cache-Control: no-cache
   Pragma: no-cache
   Content-Type: application/yang.data+json

   {
     "example-jukebox:jukebox" : {
       "library" : {
         "artist" : [
           {
             "name" : "Foo Fighters",
             "album" : [
               {
                 "name" : "Wasting Light",
                 "genre" : "example-jukebox:alternative",
                 "year" : 2011,
                 "song" : [
                   {
                     "name" : "Wasting Light",
                     "location" :
                       "/media/foo/a7/wasting-light.mp3",
                     "format" : "MP3",
                     "length" " 286
                   },
                   {
                     "name" : "Rope",
                     "location" : "/media/foo/a7/rope.mp3",
                     "format" : "MP3",
                     "length" " 259
                   }
                 ]
               }
             ]
           }
         ]
       },
       "playlist" : [
         {
           "name" : "Foo-One",
           "description" : "example playlist 1",
           "song" : [
             {
               "index" : 1,
               "id" : "https://example.com/restconf/data/
                     example-jukebox:jukebox/library/artist=
                     Foo%20Fighters/album=Wasting%20Light/
                     song=Rope"
             },
             {
               "index" : 2,
               "id" : "https://example.com/restconf/data/
                     example-jukebox:jukebox/library/artist=
                     Foo%20Fighters/album=Wasting%20Light/song=
                     Bridge%20Burning"
             }
           ]
         }
       ],
       "player" : {
         "gap" : 0.5
       }
     }
   }
	    ]]></artwork>
	</figure>
    <t>
Example 2: depth=1
    </t>
    <t>
To determine if 1 or more resource instances exist for
a given target resource, the value &quot;1&quot; is used.
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/example-jukebox:jukebox?depth=1 HTTP/1.1
   Host: example.com
   Accept: application/yang.data+json
	    ]]></artwork>
	</figure>
    <t>
The server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:11:30 GMT
   Server: example-server
   Cache-Control: no-cache
   Pragma: no-cache
   Content-Type: application/yang.data+json

   {
     "example-jukebox:jukebox" : [null]
   }
	    ]]></artwork>
	</figure>
    <t>
Example 3: depth=3
    </t>
    <t>
To limit the depth level to the target resource plus 2 child resource layers
the value &quot;3&quot; is used.
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/example-jukebox:jukebox?depth=3 HTTP/1.1
   Host: example.com
   Accept: application/yang.data+json
	    ]]></artwork>
	</figure>
    <t>
The server might respond:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:11:30 GMT
   Server: example-server
   Cache-Control: no-cache
   Pragma: no-cache
   Content-Type: application/yang.data+json

   {
     "example-jukebox:jukebox" : {
       "library" : {
         "artist" : [ null ]
       },
       "playlist" : [
         {
           "name" : "Foo-One",
           "description" : "example playlist 1",
           "song" : [ null ]
         }
       ],
       "player" : {
         "gap" : 0.5
       }
     }
   }
	    ]]></artwork>
	</figure>
</section>
<section title="&quot;fields&quot; Parameter" anchor="fields-parameter">
    <t>
In this example the client is retrieving the API resource, but
retrieving only the &quot;name&quot; and &quot;revision&quot; nodes
from each module, in JSON format:
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data?fields=ietf-yang-library:modules/
       module(name;revision) HTTP/1.1
   Host: example.com
   Accept: application/yang.data+json
	    ]]></artwork>
	</figure>
    <t>
The server might respond as follows.
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:01:00 GMT
   Server: example-server
   Content-Type: application/yang.data+json

   {
     "ietf-yang-library:modules": {
       "module": [
         {
           "name" : "example-jukebox",
           "revision" : "2015-06-04"
         },
         {
           "name" : "ietf-inet-types",
           "revision" : "2013-07-15"
         },
         {
           "name" : "ietf-restconf-monitoring",
           "revision" : "2015-06-19"
         },
         {
           "name" : "ietf-yang-library",
           "revision" : "2015-07-03"
         },
         {
           "name" : "ietf-yang-types",
           "revision" : "2013-07-15"
         }

       ]
     }
   }
	    ]]></artwork>
	</figure>
</section>
<section title="&quot;insert&quot; Parameter" anchor="insert-parameter">
    <t>
In this example, a new first entry in the &quot;Foo&#8209;One&quot; playlist
is being created.
    </t>
    <t>
Request from client:
    </t>
	<figure>
	    <artwork><![CDATA[
   POST /restconf/data/example-jukebox:jukebox/
       playlist=Foo-One?insert=first HTTP/1.1
   Host: example.com
   Content-Type: application/yang.data+json

   {
     "example-jukebox:song" : {
        "index" : 1,
        "id" : "/example-jukebox:jukebox/library/
            artist=Foo%20Fighters/album=Wasting%20Light/song=Rope"
      }
   }
	    ]]></artwork>
	</figure>
    <t>
Response from server:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 201 Created
   Date: Mon, 23 Apr 2012 13:01:20 GMT
   Server: example-server
   Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT
   Location: https://example.com/restconf/data/
       example-jukebox:jukebox/playlist=Foo-One/song=1
   ETag: eeeada438af
	    ]]></artwork>
	</figure>
</section>
<section title="&quot;point&quot; Parameter" anchor="point-parameter">
    <t>
In this example, the client is inserting a new &quot;song&quot;
resource within an &quot;album&quot; resource after another song.
The request URI is split for display purposes only.
    </t>
    <t>
Request from client:
    </t>
	<figure>
	    <artwork><![CDATA[
   POST /restconf/data/example-jukebox:jukebox/
       library/artist=Foo%20Fighters/album=Wasting%20Light?
       insert=after&point=%2Fexample-jukebox%3Ajukebox%2F
       library%2Fartist%2FFoo%20Fighters%2Falbum%2F
       Wasting%20Light%2Fsong%2FBridge%20Burning   HTTP/1.1
   Host: example.com
   Content-Type: application/yang.data+json

   {
     "example-jukebox:song" : {
       "name" : "Rope",
       "location" : "/media/foo/a7/rope.mp3",
       "format" : "MP3",
       "length" : 259
     }
   }
	    ]]></artwork>
	</figure>
    <t>
Response from server:
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 204 No Content
   Date: Mon, 23 Apr 2012 13:01:20 GMT
   Server: example-server
   Last-Modified: Mon, 23 Apr 2012 13:01:20 GMT
   ETag: abcada438af
	    ]]></artwork>
	</figure>
</section>
<section title="&quot;filter&quot; Parameter" anchor="ex-filters">
    <t>
The following URIs show some examples of notification filter
specifications (lines wrapped for display purposes only):
    </t>
	<figure>
	    <artwork><![CDATA[
   // filter = /event/event-class='fault'
   GET /streams/NETCONF?filter=%2Fevent%2Fevent-class%3D'fault'

   // filter = /event/severity<=4
   GET /streams/NETCONF?filter=%2Fevent%2Fseverity%3C%3D4

   // filter = /linkUp|/linkDown
   GET /streams/SNMP?filter=%2FlinkUp%7C%2FlinkDown

   // filter = /*/reporting-entity/card!='Ethernet0'
   GET /streams/NETCONF?
      filter=%2F*%2Freporting-entity%2Fcard%21%3D'Ethernet0'

   // filter = /*/email-addr[contains(.,'company.com')]
   GET /streams/critical-syslog?
      filter=%2F*%2Femail-addr[contains(.%2C'company.com')]

   // Note: the module name is used as prefix.
   // filter = (/example-mod:event1/name='joe' and
   //           /example-mod:event1/status='online')
   GET /streams/NETCONF?
     filter=(%2Fexample-mod%3Aevent1%2Fname%3D'joe'%20and
             %20%2Fexample-mod%3Aevent1%2Fstatus%3D'online')

   // To get notifications from just two modules (e.g., m1 + m2)
   // filter=(/m1:* or /m2:*)
   GET /streams/NETCONF?filter=(%2Fm1%3A*%20or%20%2Fm2%3A*)
	    ]]></artwork>
	</figure>
</section>
<section title="&quot;start&#8209;time&quot; Parameter" anchor="start-time-parameter">
	<figure>
	    <artwork><![CDATA[
   // start-time = 2014-10-25T10:02:00Z
   GET /streams/NETCONF?start-time=2014-10-25T10%3A02%3A00Z
	    ]]></artwork>
	</figure>
</section>
<section title="&quot;stop&#8209;time&quot; Parameter" anchor="stop-time-parameter">
	<figure>
	    <artwork><![CDATA[
   // stop-time = 2014-10-25T12:31:00Z
   GET /mystreams/NETCONF?stop-time=2014-10-25T12%3A31%3A00Z
	    ]]></artwork>
	</figure>
</section>
<section title="&quot;with&#8209;defaults&quot; Parameter" anchor="with-defaults-example">
    <t>
The following YANG module is assumed for this example.
    </t>
	<figure>
	    <artwork><![CDATA[
  module example-interface {
    prefix "exif";
    namespace "urn:example.com:params:xml:ns:yang:example-interface";

    container interfaces {
      list interface {
        key name;
        leaf name { type string; }
        leaf mtu { type uint32; }
        leaf status {
          config false;
          type enumeration {
            enum up;
            enum down;
            enum testing;
          }
        }
      }
    }
  }
	    ]]></artwork>
	</figure>
    <t>
Assume the same data model as defined in Appendix A.1 of <xref target="RFC6243"/>.
Assume the same data set as defined in Appendix A.2 of <xref target="RFC6243"/>.
If the server defaults-uri basic-mode is &quot;trim&quot;, the the
following request for interface &quot;eth1&quot; might be as follows:
    </t>
    <t>
Without query parameter:
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/example:interfaces/interface=eth1 HTTP/1.1
   Host: example.com
   Accept: application/yang.data+json
	    ]]></artwork>
	</figure>
    <t>
The server might respond as follows.
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:01:00 GMT
   Server: example-server
   Content-Type: application/yang.data+json

   {
     "example:interface": [
       {
         "name" : "eth1",
         "status" : "up"
       }
     ]
   }
	    ]]></artwork>
	</figure>
    <t>
Note that the &quot;mtu&quot; leaf is missing because it is set to
the default &quot;1500&quot;, and the server defaults handling
basic-mode is &quot;trim&quot;.
    </t>
    <t>
With query parameter:
    </t>
	<figure>
	    <artwork><![CDATA[
   GET /restconf/data/example:interfaces/interface=eth1
       ?with-defaults=report-all HTTP/1.1
   Host: example.com
   Accept: application/yang.data+json
	    ]]></artwork>
	</figure>
    <t>
The server might respond as follows.
    </t>
	<figure>
	    <artwork><![CDATA[
   HTTP/1.1 200 OK
   Date: Mon, 23 Apr 2012 17:01:00 GMT
   Server: example-server
   Content-Type: application/yang.data+json

   {
     "example:interface": [
       {
         "name" : "eth1",
         "mtu" : 1500,
         "status" : "up"
       }
     ]
   }
	    ]]></artwork>
	</figure>
    <t>
Note that the server returns the &quot;mtu&quot; leaf because the &quot;report&#8209;all&quot;
mode was requested with the &quot;with&#8209;defaults&quot; query parameter.
    </t>
</section>
</section>
</section>
</back></rfc>
