Network Working Group                                         A. Bierman
Internet-Draft                                                 YumaWorks
Intended status: Standards Track                            M. Bjorklund
Expires: January 4, April 11, 2015                                   Tail-f Systems
                                                               K. Watsen
                                                        Juniper Networks
                                                             R. Fernando
                                                                   Cisco
                                                            July 3,
                                                         October 8, 2014

                           RESTCONF Protocol
                     draft-ietf-netconf-restconf-01
                     draft-ietf-netconf-restconf-02

Abstract

   This document describes an HTTP-based protocol that provides a
   programmatic interface for accessing data defined in YANG, using the
   datastores defined in NETCONF.

Status of this This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at http://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on January 4, April 11, 2015.

Copyright Notice

   Copyright (c) 2014 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . . .  5   4
     1.1.  Secure Transport  . . . . . . . . . . . . . . . . . . . . .   5
     1.2.  Simple Subset of NETCONF Functionality  . . . . . . . . . .   5
     1.3.  Data Model Driven API . . . . . . . . . . . . . . . . . .   6
     1.4.  Terminology . . . . . . . . . . . . . . . . . . . . . . .  8   7
       1.4.1.  NETCONF . . . . . . . . . . . . . . . . . . . . . . .  8   7
       1.4.2.  HTTP  . . . . . . . . . . . . . . . . . . . . . . . . .   8
       1.4.3.  YANG  . . . . . . . . . . . . . . . . . . . . . . . . .  9   8
       1.4.4.  Terms . . . . . . . . . . . . . . . . . . . . . . . . 10   9
       1.4.5.  Tree Diagrams . . . . . . . . . . . . . . . . . . . . 11  10
   2.  Operations  Resources . . . . . . . . . . . . . . . . . . . . . . . . . . 12  11
     2.1.  OPTIONS  . . .  RESTCONF Resource Types . . . . . . . . . . . . . . . . .  11
     2.2.  Resource Discovery  . . . . . 12
     2.2.  HEAD . . . . . . . . . . . . . .  12
     2.3.  API Resource  . . . . . . . . . . . . . 13
     2.3.  GET . . . . . . . . .  12
       2.3.1.  {+restconf}/data  . . . . . . . . . . . . . . . . . .  13
     2.4.  POST .
       2.3.2.  {+restconf}/operations  . . . . . . . . . . . . . . .  14
     2.4.  Datastore Resource  . . . . . . . . . . . 14
       2.4.1.  Create Resource Mode . . . . . . . .  14
       2.4.1.  Edit Collision Detection  . . . . . . . . . 14
       2.4.2.  Invoke Operation Mode . . . . .  14
     2.5.  Data Resource . . . . . . . . . . . 15
     2.5.  PUT . . . . . . . . . . .  15
       2.5.1.  Encoding YANG Instance Identifiers in the Request URI  16
       2.5.2.  Defaults Handling . . . . . . . . . . . . . . . . 16
     2.6.  PATCH . .  18
     2.6.  Operation Resource  . . . . . . . . . . . . . . . . . . .  19
       2.6.1.  Encoding Operation Input Parameters . . . . . 17
     2.7.  DELETE . . . .  19
       2.6.2.  Encoding Operation Output Parameters  . . . . . . . .  20
     2.7.  Schema Resource . . . . . . . . . . . . . . 18
     2.8.  Query Parameters . . . . . . .  21
     2.8.  Stream Resource . . . . . . . . . . . . . . 19
   3.  Messages . . . . . . .  22
     2.9.  Errors Resource . . . . . . . . . . . . . . . . . . . . 21
     3.1.  Request URI Structure .  23
   3.  Operations  . . . . . . . . . . . . . . . . . 21
     3.2.  RESTCONF Path Resolution . . . . . . . .  23
     3.1.  OPTIONS . . . . . . . . . 22
     3.3.  Message Headers . . . . . . . . . . . . . . . .  24
     3.2.  HEAD  . . . . . 23
     3.4.  Message Encoding . . . . . . . . . . . . . . . . . . . . .  24
     3.5.  RESTCONF Meta-Data . . . .
     3.3.  GET . . . . . . . . . . . . . . . . 25
     3.6.  Return Status . . . . . . . . . . .  24
     3.4.  POST  . . . . . . . . . . . 25
     3.7.  Message Caching . . . . . . . . . . . . . . .  25
       3.4.1.  Create Resource Mode  . . . . . . 25
   4.  Resources . . . . . . . . . .  26
       3.4.2.  Invoke Operation Mode . . . . . . . . . . . . . . . .  26
     4.1.  RESTCONF Resource Types
     3.5.  PUT . . . . . . . . . . . . . . . . . 26
     4.2.  Resource Discovery . . . . . . . . . .  27
     3.6.  PATCH . . . . . . . . . . 27
     4.3.  API Resource . . . . . . . . . . . . . . . .  28
     3.7.  DELETE  . . . . . . . 27
       4.3.1.  {+restconf}/data . . . . . . . . . . . . . . . . . .  30
     3.8.  Query Parameters  . 28
       4.3.2.  {+restconf}/modules . . . . . . . . . . . . . . . . . 29
       4.3.3.  {+restconf}/operations . .  30
       3.8.1.  Query Parameter URIs  . . . . . . . . . . . . . . 30
       4.3.4.  {+restconf}/streams . .  31
       3.8.2.  The "content" Query Parameter . . . . . . . . . . . .  32
       3.8.3.  The "depth" Query Parameter . . . 30
     4.4.  Datastore Resource . . . . . . . . . .  32
       3.8.4.  The "select" Query Parameter  . . . . . . . . . . 30
       4.4.1.  Edit Collision Detection . .  33
       3.8.5.  The "insert" Query Parameter  . . . . . . . . . . . .  34
       3.8.6.  The "point" Query Parameter . 31
     4.5.  Data Resource . . . . . . . . . . . .  34
       3.8.7.  The "filter" Query Parameter  . . . . . . . . . . 31
       4.5.1.  Encoding YANG Instance Identifiers in the Request
               URI . .  35
       3.8.8.  The "start-time" Query Parameter  . . . . . . . . . .  36
       3.8.9.  The "stop-time" Query Parameter . . . . . . . . . . .  36
   4.  Messages  . . 32
       4.5.2.  Defaults Handling . . . . . . . . . . . . . . . . . . 34
     4.6.  Operation Resource . . . . . .  37
     4.1.  Request URI Structure . . . . . . . . . . . . . . 35
       4.6.1.  Encoding Operation Input Parameters . . . .  37
     4.2.  RESTCONF Path Resolution  . . . . . . . . . 35
       4.6.2. . . . . . . .  38
     4.3.  Message Headers . . . . . . . . . . . . . . . . . . . . .  39
     4.4.  Message Encoding Operation Output Parameters  . . . . . . . . . 36
     4.7.  Schema Resource . . . . . . . . . . .  40
     4.5.  RESTCONF Meta-Data  . . . . . . . . . . . 37
     4.8.  Stream Resource . . . . . . . .  41
     4.6.  Return Status . . . . . . . . . . . . . . 38
     4.9.  Errors Resource . . . . . . . .  41
     4.7.  Message Caching . . . . . . . . . . . . . 38 . . . . . . . .  41
   5.  Notifications . . . . . . . . . . . . . . . . . . . . . . . . 39  42
     5.1.  Server Support  . . . . . . . . . . . . . . . . . . . . . . 39  42
     5.2.  Event Streams . . . . . . . . . . . . . . . . . . . . . . 39  42
     5.3.  Subscribing to Receive Notifications  . . . . . . . . . . . 40  43
       5.3.1.  NETCONF Event Stream  . . . . . . . . . . . . . . . . . 41  44
     5.4.  Receiving Event Notifications . . . . . . . . . . . . . . 41  45
   6.  Error Reporting . . . . . . . . . . . . . . . . . . . . . . . 43  46
     6.1.  Error Response Message  . . . . . . . . . . . . . . . . . . 44  48
   7.  RESTCONF module . . . . . . . . . . . . . . . . . . . . . . . 47  50
   8.  IANA Considerations  RESTCONF Monitoring . . . . . . . . . . . . . . . . . . . . . 61  56
     8.1.  The "restconf" Relation Type  restconf-state/capabilities . . . . . . . . . . . . . . . 61  56
     8.2.  YANG Module Registry  restconf-state/streams  . . . . . . . . . . . . . . . . .  57
     8.3.  RESTCONF Monitoring Module  . . 61
     8.3.  application/yang Media Sub Types . . . . . . . . . . . . . 61  57
   9.  Security Considerations  YANG Module Library . . . . . . . . . . . . . . . . . . . . 63
   10. References .  60
     9.1.  modules . . . . . . . . . . . . . . . . . . . . . . . . . 64
     10.1. Normative References  61
       9.1.1.  modules/module  . . . . . . . . . . . . . . . . . . . 64
     10.2. Informative References  61
     9.2.  YANG Library Module . . . . . . . . . . . . . . . . . . 65
   Appendix A.  Change Log .  62
   10. IANA Considerations . . . . . . . . . . . . . . . . . . . . .  66
     A.1.  00 - 01
     10.1.  The "restconf" Relation Type . . . . . . . . . . . . . .  66
     10.2.  YANG Module Registry . . . . . . . . . . . 66
     A.2.  bierman:restconf-04 to ietf:restconf-00 . . . . . . .  66
     10.3.  application/yang Media Sub Types . . 67
   Appendix B.  Open Issues . . . . . . . . . .  67
     10.4.  NETCONF Capability URNs  . . . . . . . . . . . 68
     B.1.  select parameter . . . . .  68
   11. Security Considerations . . . . . . . . . . . . . . . . 68
     B.2.  netconf-state monitoring support . . .  68
   12. Acknowledgements  . . . . . . . . . . 68
     B.3.  secure transport . . . . . . . . . . . .  69
   13. References  . . . . . . . . . 68
     B.4.  Encoding of key leafs in resource URIs . . . . . . . . . . 68
     B.5.  get-bulk query parameters . . . . . .  69
     13.1.  Normative References . . . . . . . . . . 69
     B.6.  defaults handling . . . . . . . .  69
     13.2.  Informative References . . . . . . . . . . . . 69
     B.7.  protocol capability URIs . . . . .  71
   Appendix A.  Change Log . . . . . . . . . . . . 69
     B.8.  target resource list keys required for GET . . . . . . . . 70 .  71
     A.1.  01 - 02 . . . . . . . . . . . . . . . . . . . . . . . . .  71
     A.2.  00 - 01 . . . . . . . . . . . . . . . . . . . . . . . . .  72
     A.3.  bierman:restconf-04 to ietf:restconf-00 . . . . . . . . .  73
   Appendix B.  Open Issues  . . . . . . . . . . . . . . . . . . . .  73
   Appendix C.  Example YANG Module  . . . . . . . . . . . . . . . . . 71  73
     C.1.  example-jukebox YANG Module . . . . . . . . . . . . . . . 71  74
   Appendix D.  RESTCONF Message Examples  . . . . . . . . . . . . . . 77  79
     D.1.  Resource Retrieval Examples . . . . . . . . . . . . . . . 77  80
       D.1.1.  Retrieve the Top-level API Resource . . . . . . . . . 77  80
       D.1.2.  Retrieve The Server Module Information  . . . . . . .  81
       D.1.3.  Retrieve The Server Capability Information  . . . 79 . .  82
     D.2.  Edit Resource Examples  . . . . . . . . . . . . . . . . . . 81  83
       D.2.1.  Create New Data Resources . . . . . . . . . . . . . . 81  83
       D.2.2.  Detect Resource Entity Tag Change . . . . . . . . . . 82  84
     D.3.  Query String Parameter Examples  . . . . . . . . . . . . . 82 . . .  85
       D.3.1.  "content" Parameter . . . . . . . . . . . . . . . . . 82  85
       D.3.2.  "depth" Parameter . . . . . . . . . . . . . . . . . . 85  88
       D.3.3.  "filter"  "select" Parameter  . . . . . . . . . . . . . . . . . . 88  91
       D.3.4.  "insert" Parameter  . . . . . . . . . . . . . . . . . . 89  92
       D.3.5.  "point" Parameter . . . . . . . . . . . . . . . . . . 90  93
       D.3.6.  "select"  "filter" Parameter  . . . . . . . . . . . . . . . . . . 90  93
       D.3.7.  "start-time" Parameter  . . . . . . . . . . . . . . . . 91  94
       D.3.8.  "stop-time" Parameter . . . . . . . . . . . . . . . . 91  94
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . . . 92  94

1.  Introduction

   There is a need for standard mechanisms to allow WEB applications to
   access the configuration data, operational data, data-model specific
   protocol operations, and notification events within a networking
   device, in a modular and extensible manner.

   This document describes an HTTP [RFC2616] based protocol called
   RESTCONF, for accessing data defined in YANG [RFC6020], using
   datastores defined in NETCONF [RFC6241].

   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 notification events.  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.

   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 [W3C.REC-xml-20081126]
   or JSON [JSON].

   Data-model specific protocol operations defined with the YANG "rpc"
   statement can be invoked with the POST method.  Data-model specific
   notification events defined with the YANG "notification" statement
   can be accessed.

1.1.  Secure Transport

   RESTCONF relies on TLS [RFC2246] to provide privacy and data
   integrity for its HTTP operations.  More specifically, RESTCONF
   requires HTTP over TLS (HTTPS) [RFC2818].  To ensure security,
   RESTCONF clients MUST verify the RESTCONF server's X.509 certificate
   using the path validation algorithm defined in section 6 of
   [RFC5280].  Devices that do not support TLS will be unable to
   implement RESTCONF.

1.2.  Simple Subset of NETCONF Functionality

   The framework and meta-model used for an HTTP-based API does not need
   to mirror those used by the NETCONF protocol, but it needs to be
   compatible with NETCONF.  A simplified framework and protocol is
   needed that utilizes the three NETCONF datastores (candidate,
   running, startup), but hides the complexity of multiple datastores
   from the client.

   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.

   Applications that require more complex transaction capabilities might
   consider NETCONF instead of RESTCONF.  The following transaction
   features are not directly provided in RESTCONF:

   o  datastore locking (full or partial)

   o  candidate datastore

   o  startup datastore

   o  validate operation

   o  confirmed-commit procedure

   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.

   The following figure shows the system components:

         +-----------+           +-----------------+
         |  WEB app  | <-------> |                 |
         +-----------+   HTTP    | network device  |
                                 |                 |
         +-----------+           |   +-----------+ |
         |  NMS app  | <-------> |   | datastore | |
         +-----------+  NETCONF  |   +-----------+ |
                                 +-----------------+

1.3.  Data Model Driven API

   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 [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's
   doctoral dissertation [rest-dissertation].

   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 discover each new child resource as it
   traverses the URIs returned as Location IDs to discover the server
   capabilities.  This approach has 3 significant weaknesses with
   regards to control of complex networking devices:

   o  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.

   o  no data model richness: without a data model, the schema-level
      semantics and validation constraints are not available to the
      application.

   o  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.

   Data model modules such as YANG modules serve as an "API contract"
   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.

   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.

   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.

   The RESTCONF protocol operates on a conceptual datastore defined with
   the YANG data modeling language.  The server lists each YANG module
   it supports under "{+restconf}/modules" in the top-level API resource
   type, using a structure based on the YANG module capability URI
   format defined in [RFC6020].

   The conceptual datastore contents, data-model-specific operations and
   notification events are identified by this set of YANG module
   resources.  All RESTCONF content identified as either a data
   resource, operation resource, or event stream resource is defined
   with the YANG language.

   The classification of data as configuration or non-configuration is
   derived from the YANG "config" statement.  Data ordering behavior is
   derived from the YANG "ordered-by" statement.

   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.

1.4.  Terminology

   The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
   "OPTIONAL" in this document are to be interpreted as described in BCP
   14, [RFC2119].

1.4.1.  NETCONF

   The following terms are defined in [RFC6241]:

   o  candidate configuration datastore

   o  client

   o  configuration data

   o  datastore
   o  configuration datastore

   o  protocol operation

   o  running configuration datastore

   o  server

   o  startup configuration datastore

   o  state data

   o  user

1.4.2.  HTTP

   The following terms are defined in [RFC2616]:

   o  entity tag

   o  fragment

   o  header line

   o  message body

   o  method

   o  path

   o  query

   o  request

   o  request URI

   o  response body

   o  resource

1.4.3.  YANG

   The following terms are defined in [RFC6020]:

   o  container

   o  data node
   o  key leaf

   o  leaf

   o  leaf-list

   o  list

   o  presence container (or P-container)

   o  RPC operation (now called protocol operation)

   o  non-presence container (or NP-container)

   o  ordered-by system

   o  ordered-by user

1.4.4.  Terms

   The following terms are used within this document:

   o  API resource: a resource with the media type "application/
      yang.api+xml" or "application/yang.api+json".  API resources can
      only be edited by the server.

   o  data resource: a resource with the media type "application/
      yang.data+xml" or "application/yang.data+json".  Data resources
      can be edited by clients or the server.  All YANG data node types
      can be data resources.  YANG terminal nodes cannot contain child
      resources.

   o  datastore resource: a resource with the media type "application/
      yang.datastore+xml" or "application/yang.datastore+json".
      Represents a configuration datastore.

   o  edit operation: a RESTCONF operation on a data resource using the
      POST, PUT, PATCH, or DELETE method.

   o  event stream resource: a resource with the media type
      "application/yang.stream+xml" or "application/yang.stream+json". This resource represents an SSE (Server-Sent (Server-
      Sent Events) event stream.  The content consists of text using the
      media type "text/
      event-stream", "text/event-stream", as defined by the HTML5
      specification.  Each event represents one <notification> message
      generated by the server.  It contains a conceptual system or data-model data-
      model specific event that is delivered within a notification event
      stream.

   o  operation: the conceptual RESTCONF operation for a message,
      derived from the HTTP method, request URI, headers, and message
      body.

   o  operation resource: a resource with the media type "application/
      yang.operation+xml" or "application/yang.operation+json".

   o  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.

   o  plain patch: a PATCH request where the media type is "application/
      yang.data+xml" or "application/yang.data+json".

   o  query parameter: a parameter (and its value if any), encoded
      within the query component of the request URI.

   o  retrieval request: a request using the GET or HEAD methods.

   o  target resource: the resource that is associated with a particular
      message, identified by the "path" component of the request URI.

   o  unified datastore: A conceptual representation of the device
      running configuration.  The server will hide all NETCONF datastore
      details for edit operations, such as the ":candidate" and
      ":startup" capabilities.

   o  schema resource: a resource with the media type "application/
      yang".  The YANG representation of the schema can be retrieved by
      the client with the GET method.

   o  YANG terminal node: a YANG node representing a leaf, leaf-list, or
      anyxml definition.

1.4.5.  Tree Diagrams

   A simplified graphical representation of the data model is used in
   this document.  The meaning of the symbols in these diagrams is as
   follows:

   o  Brackets "[" and "]" enclose list keys.

   o  Abbreviations before data node names: "rw" means configuration
      data (read-write) and "ro" state data (read-only).

   o  Symbols after data node names: "?" means an optional node, "!"
      means a presence container, and "*" denotes a list and leaf-list.

   o  Parentheses enclose choice and case nodes, and case nodes are also
      marked with a colon (":").

   o  Ellipsis ("...") stands for contents of subtrees that are not
      shown.

2.  Operations  Resources

   The RESTCONF protocol uses HTTP methods to identify operates on a hierarchy of resources, starting
   with the CRUD
   operation requested for top-level API resource itself.  Each resource represents a particular resource.
   manageable component within the device.

   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 following table shows how child resource types and methods allowed on them are
   data-model specific.

   A resource has its own media type identifier, represented by the
   "Content-Type" 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.

   All RESTCONF operations relate to
   NETCONF protocol operations:

            +----------+-------------------------------------+
            | RESTCONF | NETCONF                             |
            +----------+-------------------------------------+ resources are defined in this document except datastore
   contents, protocol operations, and notification events.  The syntax
   and semantics for these resource types are defined in YANG modules.

   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 notification event messages supported by the server.

   The resources used in the RESTCONF protocol are identified by the
   "path" component in the request URI.  Each operation is performed on
   a target resource.

2.1.  RESTCONF Resource Types

   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:

                +-----------+----------------------------+
                | OPTIONS Resource  | none Media Type                 |
                +-----------+----------------------------+
                | HEAD API       | none application/yang.api       |
                | GET Datastore | <get-config>, <get> application/yang.datastore |
                | POST Data      | <edit-config> (operation="create") application/yang.data      |
                | PUT Errors    | <edit-config> (operation="replace") application/yang.errors    |
                | PATCH Operation | <edit-config> (operation="merge") application/yang.operation |
                | DELETE Schema    | <edit-config> (operation="delete") application/yang           |
            +----------+-------------------------------------+

                     Table 1: CRUD Methods in
                +-----------+----------------------------+

                           RESTCONF

   The NETCONF "remove" operation attribute is not supported Media Types

2.2.  Resource Discovery

   A client SHOULD start by retrieving the HTTP
   DELETE method. top-level API resource, using
   the entry point URI defined in Section 4.2.

   The RESTCONF protocol does not include a resource must exist or discovery
   mechanism.  Instead, the DELETE method will
   fail.  The PATCH method is equivalent definitions within the YANG modules
   advertised by the server are used to construct a "merge" predictable
   operation for a
   plain patch.

   Access control mechanisms may or data resource identifier.

   The "depth" query parameter (see Section 3.8.3) can be used to limit what operations
   control how many descendant levels should be included when retrieving
   child resources.  This parameter can be
   used.  In particular, RESTCONF is compatible used with the NETCONF Access
   Control Model (NACM) [RFC6536], as there is GET method to
   discover child resources within a specific mapping
   between RESTCONF and NETCONF operations, defined in Table 1. particular resource.

2.3.  API Resource

   The API resource path needs to be converted internally by the server to the
   corresponding YANG instance-identifier.  Using this information, the
   server can apply contains the NACM state and access control rules to RESTCONF messages.

   The server MUST NOT allow any operation to any resources that the
   client is not authorized to access.

   Implementation of all methods (except PATCH) are defined in
   [RFC2616].  This section defines points for the
   RESTCONF protocol usage for each
   HTTP method.

2.1.  OPTIONS

   The OPTIONS method features.  It is sent by the client to discover which methods
   are supported by top-level resource and has the server for a specific resource.  If supported,
   it SHOULD be implemented for all media types.
   type "application/yang.api+xml" or "application/yang.api+json".

   YANG Tree Diagram for "application/yang.api" Resource Type:

      +--rw restconf
         +--rw data
         +--rw operations

   The server SHOULD implement this method, however "restconf" grouping definition in the same information
   could be extracted from "ietf-restconf" module
   defined in Section 7 is used to specify the YANG modules structure and syntax of
   the RESTCONF protocol
   specification.

   If the PATCH method is supported, then conceptual child resources within the "Accept-Patch" header MUST API resource.

   This resource has the following child resources:

            +----------------+--------------------------------+
            | Child Resource | Description                    |
            +----------------+--------------------------------+
            | data           | Contains all data resources    |
            | operations     | Data-model specific operations |
            +----------------+--------------------------------+

                           RESTCONF API Resource

2.3.1.  {+restconf}/data

   This mandatory resource represents the combined configuration and
   operational data resources that can be supported, as defined in [RFC5789].

2.2.  HEAD accessed by a client.  It
   cannot be created or deleted by the client.  The HEAD method datastore resource
   type is sent defined in Section 2.4.

   Example:

   This example request by the client to would retrieve just only the headers non-
   configuration data nodes that would be returned for exist within the comparable GET method, without "library" resource,
   using the
   response body.  It is supported for all resource types, except
   operation resources. "content" query parameter (see Section 3.8.2).

      GET /restconf/data/example-jukebox:jukebox/library
         ?content=nonconfig  HTTP/1.1
      Host: example.com
      Accept: application/yang.data+json,
              application/yang.errors+json

   The request MUST contain server might respond:

      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+json

      {
        "example-jukebox:library" : {
           "artist-count" : 42,
           "album-count" : 59,
           "song-count" : 374
        }
      }

2.3.2.  {+restconf}/operations

   This optional resource is a request URI container that contains at least provides access to the
   entry point component.  The same query parameters
   data-model specific protocol operations supported by the
   GET method server.  The
   server MAY omit this resource if no data-model specific operations
   are supported advertised.

   Any data-model specific operations defined in the YANG modules
   advertised by the HEAD method.

   The access control behavior is enforced server MAY be available as if the method was GET
   instead child nodes of HEAD.  The server MUST respond the same as if the method
   was GET instead of HEAD, except that no response body is included.

2.3.  GET this
   resource.

   Operation resources are defined in Section 2.6.

2.4.  Datastore Resource

   The GET method is sent by "{+restconf}/data" subtree represents the client to retrieve data and meta-data
   for datastore resource
   type, which is a resource.  It collection of configuration and operational data
   nodes.

   A "unified datastore" interface is supported for all used to simplify resource types, except
   operation resources. editing
   for the client.  The request MUST contain RESTCONF unified datastore is a request URI conceptual
   interface to the native configuration datastores that
   contains at least are present on
   the entry point component. device.

   The server MUST NOT return any data resources for which underlying NETCONF datastores (i.e., candidate, running, startup)
   can be used to implement the user does
   not have read privileges.  If unified datastore, but the user server design
   is not authorized limited to read the
   target resource, an error response containing a "403 Forbidden" or
   "404 Not Found" Status-Line is returned to exact datastore procedures defined in NETCONF.

   The "candidate" and "startup" datastores are not visible in the client.

   If
   RESTCONF protocol.  Transaction management and configuration
   persistence are handled by the user is authorized to read some but server and not all of controlled by the target
   resource,
   client.

   A datastore resource can only be written directly with the unauthorized content is omitted from PATCH
   method.  Only the response
   message body, and configuration data resources within the authorized content datastore
   resource can be edited directly with all methods.

   Each RESTCONF edit of a datastore resource is returned saved to non-volatile
   storage in an implementation-specific matter by the client.

   Example:

   The client might request server.  There is
   no guarantee that configuration changes are saved immediately, or
   that the response headers for saved configuration is always a JSON
   representation mirror of the "library" resource:

      GET /restconf/data/example-jukebox:jukebox/
        library/artist=Foo%20Fighters/album  HTTP/1.1
      Host: example.com
      Accept: application/yang.data+json,
              application/yang.errors+json

   The server might respond:

      HTTP/1.1 200 OK
      Date: Mon, 23 Apr 2012 17:02:40 GMT
      Server: example-server
      Content-Type: application/yang.data+json
      Cache-Control: no-cache
      Pragma: no-cache
      ETag: a74eefc993a2b
      Last-Modified: Mon, 23 Apr 2012 11:02:14 GMT

      {
        "album" : [
          {
            "name" : "Wasting Light",
            "genre" : "example-jukebox:alternative",
            "year" : 2011
          }
        ]
      }

2.4.  POST running
   configuration.

2.4.1.  Edit Collision Detection

   Two "edit collision detection" mechanisms are provided in RESTCONF,
   for datastore and data resources.

2.4.1.1.  Timestamp

   The POST method last change time is sent by maintained and the client to create "Last-Modified" and "Date"
   headers are returned in the response for a data resource or
   invoke an operation resource. retrieval request.  The server uses the target resource
   media type
   "If-Unmodified-Since" header can be used in edit operation requests
   to determine how cause the server to process reject the request if the request.

      +-----------+------------------------------------------------+
      | Type      | Description                                    |
      +-----------+------------------------------------------------+
      | Datastore | Create a top-level configuration data resource |
      | Data      | Create a configuration data child resource     |
      | Operation | Invoke has been
   modified since the specified timestamp.

   The server MUST maintain a protocol operation                    |
      +-----------+------------------------------------------------+

                     Resource Types that Support POST

2.4.1.  Create Resource Mode

   If last-modified timestamp for this resource,
   and return the target "Last-Modified" header when this resource type is a datastore retrieved
   with the GET or HEAD methods.  Only changes to configuration data resource, then
   resources within the
   POST is treated as datastore affect this timestamp.

2.4.1.2.  Entity tag

   A unique opaque string is maintained and the "ETag" header is
   returned in the response for a request retrieval request.  The "If-Match"
   header can be used in edit operation requests to create cause the server to
   reject the request if the resource entity tag does not match the
   specified value.

   The server MUST maintain a resource entity tag for this resource, and
   return the "ETag" header when this resource is retrieved with the GET
   or child resource. HEAD methods.  The message body is expected resource entity tag MUST be changed to contain the content of a child
   resource new
   previously unused value if changes to create any configuration data
   resources within the parent (target resource).

   The "insert" and "point" query parameters are supported by the POST
   method for datastore and are made.

2.5.  Data Resource

   A data resource types, as specified in the represents a YANG definition in Section 7.

   If data node that is a descendant node
   of a datastore resource.

   For configuration data resources, the POST method succeeds, server MAY maintain a "201 Created" Status-Line is returned last-
   modified timestamp for the resource, and there is no response message body.  A "Location" return the "Last-Modified"
   header
   identifying when it is retrieved with the GET or HEAD methods.  If
   maintained, the child resource that was created timestamp MUST be present in
   the response in this case.

   If the user is not authorized set to create the target resource, an error
   response containing a "403 Forbidden" current time
   whenever the resource or "404 Not Found" Status-Line any configuration resource within the
   resource is returned to altered.

   For configuration data resources, the client.  All other error responses are handled
   according to the procedures defined in Section 6.

   Example:

   To create server MAY maintain a new "jukebox" resource
   entity tag for the resource, and return the client might send:

      POST /restconf/data HTTP/1.1
      Host: example.com
      Content-Type: application/yang.data+json

      { "example-jukebox:jukebox" : [null] } "ETag" header when it is
   retrieved as the target resource with the GET or HEAD methods.  If
   maintained, the resource is created, entity tag MUST be updated whenever the server might respond as follows:

      HTTP/1.1 201 Created
      Date: Mon, 23 Apr 2012 17:01:00 GMT
      Server: example-server
      Location: http://example.com/restconf/data/example-jukebox:jukebox
      Last-Modified: Mon, 23 Apr 2012 17:01:00 GMT
      ETag: b3a3e673be2

   Refer to Appendix D.2.1 for more
   resource creation examples.

2.4.2.  Invoke Operation Mode

   If or any configuration resource within the target resource type is an operation resource, then
   altered.

   A data resource can be retrieved with the POST
   method GET method.  Data resources
   are accessed via the "{+restconf}/data" entry point.  This sub-tree
   is treated as a request used to invoke that operation.  The message
   body (if any) is processed as retrieve and edit data resources.

   A configuration data resource can be altered by the operation input parameters. client with some
   or all of the edit operations, depending on the target resource and
   the specific operation.  Refer to Section 4.6 3 for more details on operation resources.

   If the POST request succeeds, a "200 OK" Status-Line is returned if
   there is a response message body, and edit
   operations.

   The resource definition version for a "204 No Content" Status-Line
   is returned if there data resource is no response message body.

   If identified by
   the user is not authorized to invoke revision date of the target operation, an
   error response YANG module containing a "403 Forbidden" or "404 Not Found"
   Status-Line is returned to the client.  All other error responses are
   handled according to YANG definition
   for the procedures defined data resource, specified in Section 6.

   Example:

   In this example, the client is invoking "{+restconf}/modules" sub-
   tree.

2.5.1.  Encoding YANG Instance Identifiers in the "play" operation Request URI

   In YANG, data nodes are named with an absolute XPath expression,
   defined in [XPath] , starting from the "example-jukebox" YANG module.

   A client might send a "play" request as follows:

      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
        }
      }

   The server might respond:

      HTTP/1.1 204 No Content
      Date: Mon, 23 Apr 2012 17:50:00 GMT
      Server: example-server

2.5.  PUT

   The PUT method is sent by the client document root to create or replace the target
   resource.  In RESTCONF, URL encoded Location header expressions are
   used instead.

   The only target resource media YANG "instance-identifier" (i-i) data type that supports PUT is represented in
   RESTCONF with the data
   resource.  The message body path expression format defined in this section.

           +-------+-------------------------------------------+
           | Name  | Comments                                  |
           +-------+-------------------------------------------+
           | point | Insertion point is expected to contain the content used
   to create always a full i-i      |
           | path  | Request URI path is a full or replace partial i-i |
           +-------+-------------------------------------------+

               RESTCONF instance-identifier Type Conversion

   The "path" component of the request URI contains the absolute path
   expression that identifies the target resource.

   The "insert" and "point" query parameters are supported by the PUT
   method

   A predictable location for a data resources, as specified in resource is important, since
   applications will code to the YANG definition in
   Section 7.

   Consistent with [RFC2616], if the PUT request creates a new resource,
   a "201 Created" Status-Line is returned.  If data model module, which uses
   static naming and defines an existing absolute path location for all data
   nodes.

   A RESTCONF data resource is
   modified, either "200 OK" or "204 No Content" are returned.

   If the user identifier is not authorized to create or replace the target
   resource an error response containing a "403 Forbidden" or "404 Not
   Found" Status-Line XPath expression.  It
   is returned encoded from left to right, starting with the client.  All other error
   responses are handled top-level data node,
   according to the procedures defined "api-path" rule in Section 6.

   Example:

   An "album" child resource defined in the "example-jukebox" YANG
   module is replaced or created if it does not already exist.

   To replace 2.5.1.1.  The node name
   of each ancestor of the "album" target resource contents, the client might send as
   follows.  Note that the request URI header line node is wrapped encoded in order,
   ending with the node name for
   display purposes only:

      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
        }
      } the target resource.

   If a data node in the resource path expression is updated, a YANG list node, then the server might respond:

      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

2.6.  PATCH

   RESTCONF uses
   key values for the HTTP PATCH method defined in [RFC5789] list (if any) MUST be encoded according to provide
   an extensible framework the
   following rules.

   o  The key leaf values for a data resource patching mechanisms.  It is
   optional to implement by the server.  Each patch type needs representing a unique
   media type.  Zero or more PATCH media types MAY YANG list
      MUST be supported by the
   server.

   A plain patch encoded using one path segment [RFC3986].

   o  If there is used to create or update a child resource within only one key leaf value, the
   target resource.  If path segment is
      constructed by having the target resource instance does not exist, list name followed by an "=" followed by
      the
   server MUST NOT create it. single key leaf value.

   o  If the PATCH request succeeds, a "200 OK" Status-Line is returned if there is a message body, and "204 No Content" is returned if no
   response message body is sent.

   If are multiple key leaf values, the user is not authorized to alter value of each leaf
      identified in the target resource an error
   response containing a "403 Forbidden" or "404 Not Found" Status-Line "key" statement is returned to encoded in the client. order
      specified in the YANG "key" statement, with a comma separating
      them.

   o  All other error responses the components in the "key" statement MUST be encoded.
      Partial instance identifiers are handled
   according to not supported.

   o  Quoted strings are supported in the procedures key leaf values.  Quoted
      strings MUST be used to express empty strings.  (example:
      list=foo,'',baz).

   o  The "list-instance" ABNF rule defined in Section 6.

   Example:

   To replace just 2.5.1.1
      represents the "year" field syntax of a list instance identifier.

   o  Resource URI values returned in Location headers for data
      resources MUST identify the "album" resource (instead of
   replacing module name, even if there are no
      conflicting local names when the entire resource with is created.  This
      ensures the PUT method), correct resource will be identified even if the client might
   send server
      loads a plain patch as follows.  Note new module that the request URI header line
   is wrapped for display purposes only:

      PATCH /restconf/data/example-jukebox:jukebox/
         library/artist=Foo%20Fighters/album=Wasting%20Light HTTP/1.1
      Host: example.com
      Content-Type: application/yang.data+json old client does not know about.

   Examples:

      container top {
        "example-jukebox:album" :
           list list1 {
          "genre" : "example-jukebox:rock",
          "year" : 2011
           key "key1 key2 key3";
           ...
           list list2 {
               key "key4 key5";
               ...
               leaf X { type string; }
           }

   If the field is updated,
       }

   For the server might respond:

      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

   The XML encoding above YANG definition, URI with key leaf values will be
   encoded as follows (line wrapped for the same request might be:

      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

      <album xmlns="http://example.com/ns/example-jukebox">
         <genre>example-jukebox:rock</genre>
         <year>2011</year>
      </album>

2.7.  DELETE display purposes only):

       /restconf/data/top/list1=key1val,key2val,key3val3/
          list2=key4val,key5val/X

2.5.1.1.  ABNF For Data Resource Identifiers

   The DELETE method "api-path" ABNF syntax is used to delete the target resource.  If the
   DELETE request succeeds, a "204 No Content" Status-Line is returned,
   and there is no response message body.

   If the user is not authorized to delete the target resource then an
   error response containing a "403 Forbidden" construct RESTCONF path
   identifiers:

       api-path = "/"  |
                  ("/" api-identifier
                    0*("/" (api-identifier | list-instance )))

       api-identifier = [module-name ":"] identifier

       module-name = identifier

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

       key-value = string

       string = <a quoted or "404 Not Found"
   Status-Line is returned to the client.  All other error responses are
   handled according unquoted or empty string>

       ;; An identifier MUST NOT start with
       ;; (('X'|'x') ('M'|'m') ('L'|'l'))
       identifier  = (ALPHA / "_")
                     *(ALPHA / DIGIT / "_" / "-" / ".")

2.5.2.  Defaults Handling

   NETCONF has a rather complex model for handling default values for
   leafs.  RESTCONF attempts to avoid this complexity by restricting the procedures defined in Section 6.

   Example:

   To delete
   operations that can be applied to a resource such as the "album" resource, the client resource.  Applications that
   require full control of defaults might
   send:

      DELETE /restconf/data/example-jukebox:jukebox/
         library/artist=Foo%20Fighters/album=Wasting%20Light HTTP/1.1
      Host: example.com consider NETCONF instead of
   RESTCONF.

   If the resource target of a GET method is deleted, a data node that represents a leaf
   that has a default value, and the leaf has not been given a value
   yet, the server might respond:

      HTTP/1.1 204 No Content
      Date: Mon, 23 Apr 2012 17:49:40 GMT
      Server: example-server

2.8.  Query Parameters

   Each RESTCONF operation allows zero or more query parameters to be
   present in MUST return the request URI.  The specific parameters default value that are allowed
   depends on is in use by the resource type, and sometimes
   server.

   If the specific target
   resource used, in the request.

   +------------+----------+-------------------------------------------+
   | Name       | Methods  | Description                               |
   +------------+----------+-------------------------------------------+
   | content    | of a GET      | Select config and/or non-config method is a data      |
   |            |          | node that represents a
   container or list that has any child resources                                 |
   | depth      | GET      | Request limited sub-tree depth in the     |
   |            |          | reply content                             |
   | filter     | GET      | Boolean notification filter with default values,
   for           |
   |            |          | event-stream the child resources                    |
   | insert     | POST,    | Insertion mode for user-ordered data      |
   |            | PUT      | resources                                 |
   | point      | POST,    | Insertion point for user-ordered data     |
   |            | PUT      | resources                                 |
   | select     | GET      | Request a subset of the target resource   |
   |            |          | contents                                  |
   | start-time | GET      | Replay buffer start time for event-stream |
   |            |          | resources                                 |
   | stop-time  | GET      | Replay buffer stop time for event-stream  |
   |            |          | resources                                 |
   +------------+----------+-------------------------------------------+

                         RESTCONF Query Parameters

   Query parameters can be that have not been given in any order.  Each parameter can
   appear at most once in a request URI.  A default value may apply if yet, the parameter is missing.

   The semantics and syntax for all query parameters
   server MAY return the default values that are defined in use by the server.

2.6.  Operation Resource

   An operation resource represents an protocol operation defined with
   the
   "query-parameters" YANG grouping in Section 7.  The "rpc" statement.

   All operation resources share the same module namespace as any top-
   level data resources, so the name of an operation resource cannot
   conflict with the name of a top-level data resource defined within
   the same module.

   If 2 different YANG encoding modules define the same "rpc" identifier, then
   the module name MUST be converted to URL-encoded string for use used in the request URI.

   Refer to Appendix D.3 for examples of query parameter usage.

3.  Messages

   The RESTCONF protocol uses HTTP entities for messages.  A single HTTP
   message corresponds to  For example, if
   "module-A" and "module-B" both defined a single protocol method.  Most messages can
   perform a single task on a single resource, such "reset" operation, then
   invoking the operation from "module-A" would be requested as retrieving a follows:

      POST /restconf/operations/module-A:reset HTTP/1.1
      Server example.com

   Any usage of an operation resource or editing a resource.  The exception is from the PATCH method,
   which allows multiple datastore edits within a single message.

3.1.  Request URI Structure

   Resources are represented same module, with URIs following the structure for
   generic URIs in [RFC3986].

   A RESTCONF operation is derived from the HTTP method and
   same name, refers to the request
   URI, using same "rpc" statement definition.  This
   behavior can be used to design protocol operations that perform the following conceptual fields:

        <OP> /<restconf>/<path>?<query>#<fragment>

         ^       ^        ^       ^         ^
         |       |        |       |         |
       method  entry
   same general function on different resource  query    fragment

         M       M        O        O         I

       M=mandatory, O=optional, I=ignored

       <text> replaced by client with real values

   o  method: the HTTP method identifying types.

   If the RESTCONF operation
      requested "rpc" statement has an "input" section, then a message body
   MAY be sent by the client, to act upon the target resource specified client in the request URI.  RESTCONF operation details are described in
      Section 2.

   o  entry: request, otherwise the root of request
   message MUST NOT include a message body.  If the RESTCONF API configured on this HTTP
      server, discovered "rpc" statement has
   an "output" section, then a message body MAY be sent by getting the ".well-known/host-meta"
      resource, as described server in Section 3.2.  All of
   the examples response.  Otherwise the server MUST NOT include a message body
   in
      this document assume "/restconf" as the discovered RESTCONF API
      root path.  The URI template [RFC6570] syntax "{+restconf}" is
      used to refer to response message, and MUST send a "204 No Content" Status-Line
   instead.

2.6.1.  Encoding Operation Input Parameters

   If the entry point outside of "rpc" statement has an example.

   o  resource: the path expression identifying "input" section, then the resource that "input" node
   is
      being accessed by provided in the operation.  If this field is not present,
      then message body, corresponding to the target resource is YANG data
   definition statements within the API itself, represented by "input" section.

   Example:

   The following YANG definition is used for the
      media examples in this
   section.

       rpc reboot {
         input {
           leaf delay {
             units seconds;
             type "application/yang.api".

   o  query: uint32;
             default 0;
           }
           leaf message { type string; }
           leaf language { type string; }
         }
       }

   The client might send the set of parameters associated with following POST request message:

      POST /restconf/operations/example-ops:reboot HTTP/1.1
      Host: example.com
      Content-Type: application/yang.operation+json

      {
        "example-ops:input" : {
          "delay" : 600,
          "message" : "Going down for system maintenance",
          "language" : "en-US"
        }
      }

   The server might respond:

      HTTP/1.1 204 No Content
      Date: Mon, 25 Apr 2012 11:01:00 GMT
      Server: example-server

2.6.2.  Encoding Operation Output Parameters

   If the RESTCONF message.
      These have "rpc" statement has an "output" section, then the familiar form of "name=value" pairs.  There "output"
   node is a
      specific set of parameters defined, although provided in the server MAY choose message body, corresponding to support additional parameters not defined in this document. the YANG data
   definition statements within the "output" section.

   Example:

   The contents of following YANG definition is used for the any query parameter value MUST be encoded
      according to [RFC2396], section 3.4.  Any reserved characters MUST
      be encoded with escape sequences, according to [RFC2396], section
      2.4.

   o  fragment: This field is not used by the RESTCONF protocol.

   When new resources are created by the client, a "Location" header is
   returned, which identifies the path of the newly created resource.
   The client MUST use examples in this exact path identifier to access the resource
   once it has been created.

   The "target" of an operation is a resource.
   section.

       rpc get-reboot-info {
         output {
           leaf reboot-time {
             units seconds;
             type uint32;
           }
           leaf message { type string; }
           leaf language { type string; }
         }
       }

   The "path" field in client might send the following POST request URI represents the target resource message:

      POST /restconf/operations/example-ops:get-reboot-info HTTP/1.1
      Host: example.com
      Accept: application/yang.operation+json,
              application/yang.errors+json

   The server might respond:

      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"
        }
      }

2.7.  Schema Resource

   If the operation.

3.2.  RESTCONF Path Resolution

   In line server supports the best practices defined by [get-off-my-lawn], RESTCONF
   enables deployments to specify where "schema" leaf within the RESTCONF API is located.
   When first connecting to a RESTCONF server, a RESTCONF then the
   client MUST
   determine can retrieve the root of YANG schema text for the associated YANG
   module or submodule, using the GET method.  First the RESTCONF API.  The client discovers this by
   getting needs to
   retrieve the "/.well-known/host-meta" resource ([RFC6415]) and using URL for retrieving the <Link> element containing schema.

   The client might send the "restconf" attribute :

      Request
      ------- following GET /.well-known/host-meta users request message:

      GET /restconf/data/modules/module=
         example-jukebox,2014-07-03/schema HTTP/1.1
      Host: example.com
      Accept: application/xrd+xml

      Response
      --------
      HTTP/1.1 200 OK
      Content-Type: application/xrd+xml
      Content-Length: nnn

      <XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
          <Link rel='restconf' href='/restconf'/>
      </XRD>

   Once discovering the RESTCONF API root, the client MUST prepend it to
   any subsequent request to a RESTCONF resource.  For instance, using
   the "/restconf" path discovered above, the client can now determine
   the operations supported by the the server:

      Request
      -------
      GET /restconf/operations  HTTP/1.1
      Host: example.com
      Accept: application/yang.api+json, application/yang.data+json,
              application/yang.errors+json

      Response
      --------

   The server might respond:

      HTTP/1.1 200 OK
      Date: Mon, 23 25 Apr 2012 17:01:00 11:10:30 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" : application/yang.data+json

      { "play" : [ null ] }
        "schema":
         "http://example.com/mymodules/example-jukebox/2014-07-03"
      }

3.3.  Message Headers

   There are several HTTP header lines utilized in RESTCONF messages.
   Messages are not limited to

   Next the HTTP headers listed in this section.

   HTTP defines which header lines are required for particular
   circumstances.  Refer to each operation definition section in
   Section 2 for examples on how particular headers are used.

   There are some request headers that are used within RESTCONF, usually
   applied client needs to data resources.  The following tables summarize retrieve the
   headers most relevant in RESTCONF message requests:

   +---------------------+---------------------------------------------+
   | Name                | Description                                 |
   +---------------------+---------------------------------------------+
   | Accept              | Response Content-Types that are acceptable  |
   | Content-Type        | actual YANG schema.

   The media type of client might send the following GET request body          |
   | Host                | message:

      GET http://example.com/mymodules/example-jukebox/2014-07-03
         HTTP/1.1
      Host: example.com
      Accept: application/yang.data+json,
              application/yang.errors+json

   The host address server might respond:

      module example-jukebox {

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

         // rest of YANG module content deleted...
      }

2.8.  Stream Resource

   A "stream" resource represents a source for system generated event
   notifications.  Each stream is created and modified by the server              |
   | If-Match            | Only perform
   only.  A client can retrieve a stream resource or initiate a long-
   poll server sent event stream, using the action if procedure specified in
   Section 5.3.

   A notification stream functions according to the entity       |
   |                     | matches ETag                                |
   | If-Modified-Since   | Only perform NETCONF
   Notifications specification [RFC5277].  The "ietf-restconf" YANG
   module contains the action if modified since   |
   |                     | time                                        |
   | If-Unmodified-Since | Only perform "stream" list ("{+restconf}/streams/stream")
   which specifies the action syntax and semantics of a stream resource.

2.9.  Errors Resource

   An "errors" resource is a collection of error information that is
   sent as the message body in a server response message, if un-modified      |
   |                     | since time                                  |
   +---------------------+---------------------------------------------+ an error
   occurs while processing a request message.

   The "ietf-restconf" YANG module contains the "errors" grouping which
   specifies the syntax and semantics of an errors resource.  RESTCONF Request Headers
   error handling behavior is defined in Section 6.

3.  Operations

   The RESTCONF protocol uses HTTP methods to identify the CRUD
   operation requested for a particular resource.

   The following tables summarize table shows how the headers most relevant in RESTCONF
   message responses:

   +---------------+---------------------------------------------------+ operations relate to
   NETCONF protocol operations:

            +----------+-------------------------------------+
            | Name RESTCONF | Description NETCONF                             |
   +---------------+---------------------------------------------------+
            +----------+-------------------------------------+
            | Allow OPTIONS  | Valid actions when 405 error returned none                                |
            | Cache-Control HEAD     | The cache control parameters for the response none                                |
            | Content-Type GET      | The media type of the response body <get-config>, <get>                 |
            | Date POST     | The date and time the message was sent <edit-config> (operation="create")  |
            | ETag PUT      | An identifier for a specific version of a <edit-config> (operation="replace") |
            | PATCH    | resource <edit-config> (operation="merge")   |
            | Last-Modified DELETE   | The last modified date and time of a resource     |
   | Location      | The resource identifier for a newly created       |
   |               | resource <edit-config> (operation="delete")  |
   +---------------+---------------------------------------------------+

                         RESTCONF Response Headers

3.4.  Message Encoding

   RESTCONF messages are encoded
            +----------+-------------------------------------+

                     Table 1: CRUD Methods in RESTCONF

   The NETCONF "remove" operation attribute is not supported by the HTTP according to RFC 2616.
   DELETE method.  The
   "utf-8" character set resource must exist or the DELETE method will
   fail.  The PATCH method is used equivalent to a "merge" operation for all messages. a
   plain patch.

   Access control mechanisms may be used to limit what operations can be
   used.  In particular, RESTCONF message
   content is sent in compatible with the HTTP message body.

   Content NETCONF Access
   Control Model (NACM) [RFC6536], as there is encoded in either JSON or XML format.

   XML encoding rules for data nodes are a specific mapping
   between RESTCONF and NETCONF operations, defined in [RFC6020]. Table 1.  The same
   encoding rules are used for all XML content.

   JSON encoding rules are defined in [I-D.lhotka-netmod-json].  This
   encoding is valid JSON, but also has special encoding rules
   resource path needs to
   identify module namespaces and provide consistent type processing of
   YANG data.

   Request input content encoding format is identified with the Content-
   Type header.  This field MUST be present if a message body is sent converted internally by the client.

   Response output content encoding format is identified with server to the Accept
   header in
   corresponding YANG instance-identifier.  Using this information, the request, or if
   server can apply the NACM access control rules to RESTCONF messages.

   The server MUST NOT allow any operation to any resources that the
   client is not specified, the request input
   encoding format is used.  If there was no request input, then the
   default output encoding is XML.  File extensions encoded authorized to access.

   Implementation of all methods (except PATCH) are defined in
   [RFC2616].  This section defines the
   request are not used to identify format encoding.

3.5.  RESTCONF Meta-Data

   The RESTCONF protocol needs to retrieve the same meta-data that usage for each
   HTTP method.

3.1.  OPTIONS

   The OPTIONS method is
   used in sent by the NETCONF protocol.  Information about default leafs, last-
   modified timestamps, etc. are commonly used client to annotate
   representations of the datastore contents.  This meta-data is not
   defined in discover which methods
   are supported by the YANG schema because server for a specific resource.  If supported,
   it applies to the datastore, and
   is common across SHOULD be implemented for all data nodes.

   This media types.

   The server SHOULD implement this method, however the same information
   could be extracted from the YANG modules and the RESTCONF protocol
   specification.

   If the PATCH method is encoded supported, then the "Accept-Patch" header MUST
   be supported, as attributes in XML.  JSON encoding of
   meta-data is defined in [I-D.lhotka-netmod-json].

3.6.  Return Status

   Each message represents some sort of resource access.  An HTTP
   "Status-Line" header line is returned for each request.  If a 4xx or
   5xx range status code [RFC5789].

3.2.  HEAD

   The HEAD method is returned in sent by the Status-Line, then client to retrieve just the error
   information will headers
   that would be returned in the response, according to for the format
   defined in Section 6.1.

3.7.  Message Caching

   Since comparable GET method, without the datastore contents change at unpredictable times, responses
   from a RESTCONF server generally SHOULD NOT be cached.
   response body.  It is supported for all resource types, except
   operation resources.

   The server SHOULD include request MUST contain a "Cache-Control" header in every response request URI that specifies whether contains at least the response should be cached.  A "Pragma"
   header specifying "no-cache" MAY also be sent in case
   entry point component.  The same query parameters supported by the
   "Cache-Control" header
   GET method are supported by the HEAD method.

   The access control behavior is not supported.

   Instead enforced as if the method was GET
   instead of using HTTP caching, HEAD.  The server MUST respond the client SHOULD track same as if the "ETag"
   and/or "Last-Modified" headers returned method
   was GET instead of HEAD, except that no response body is included.

3.3.  GET

   The GET method is sent by the server for the
   datastore resource (or client to retrieve data resource if the server supports it).  A
   retrieval request and meta-data
   for a resource.  It is supported for all resource can include types, except
   operation resources.  The request MUST contain a request URI that
   contains at least the "If-None-Match"
   and/or "If-Modified-Since" headers, entry point component.

   The server MUST NOT return any data resources for which will cause the server user does
   not have read privileges.  If the user is not authorized to
   return read the
   target resource, an error response containing a "304 "403 Forbidden" or
   "404 Not Modified" Found" Status-Line if is returned to the resource has not
   changed.  The client MAY use client.

   If the HEAD method user is authorized to retrieve just read some but not all of the
   message headers, which SHOULD include target
   resource, the "ETag" and "Last-Modified"
   headers, if this meta-data unauthorized content is maintained for omitted from the target resource.

4.  Resources response
   message body, and the authorized content is returned to the client.

   Example:

   The RESTCONF protocol operates on client might request the response headers for a hierarchy JSON
   representation of resources, starting
   with the "library" resource:

      GET /restconf/data/example-jukebox:jukebox/
        library/artist=Foo%20Fighters/album  HTTP/1.1
      Host: example.com
      Accept: application/yang.data+json,
              application/yang.errors+json

   The server might respond:

      HTTP/1.1 200 OK
      Date: Mon, 23 Apr 2012 17:02:40 GMT
      Server: example-server
      Content-Type: application/yang.data+json
      Cache-Control: no-cache
      Pragma: no-cache
      ETag: a74eefc993a2b
      Last-Modified: Mon, 23 Apr 2012 11:02:14 GMT

      {
        "album" : [
          {
            "name" : "Wasting Light",
            "genre" : "example-jukebox:alternative",
            "year" : 2011
          }
        ]
      }

3.4.  POST

   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.

      +-----------+------------------------------------------------+
      | Type      | Description                                    |
      +-----------+------------------------------------------------+
      | Datastore | Create a top-level API configuration data resource itself.  Each |
      | Data      | Create a configuration data child resource represents     |
      | Operation | Invoke a
   manageable component within protocol operation                    |
      +-----------+------------------------------------------------+

                     Resource Types that Support POST

3.4.1.  Create Resource Mode

   If the device.

   A target resource can be considered type is a collection of conceptual datastore or data and resource, then the
   set of allowed methods on that data.  It can contain nested
   POST is treated as a request to create a resource or child
   resources. resource.
   The message body is expected to contain the content of a child
   resource types to create within the parent (target resource).

   The "insert" and methods allowed on them "point" query parameters are
   data-model specific.

   A resource has its own media type identifier, represented supported by the
   "Content-Type" 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.

   All RESTCONF resources are defined in this document except POST
   method for datastore
   contents, protocol operations, and notification events.  The syntax and semantics for these data resource types are defined types, as specified in the
   YANG modules.

   The RESTCONF resources are accessed via a set of URIs defined definition in this
   document.  The set of YANG modules supported by the server will
   determine Section 7.

   If the data model specific operations, top-level data node
   resources, POST method succeeds, a "201 Created" Status-Line is returned
   and notification event messages supported by there is no response message body.  A "Location" header
   identifying the server.

   The resources used child resource that was created MUST be present in
   the RESTCONF protocol are identified by the
   "path" component response in this case.

   If the request URI.  Each operation user is performed on
   a not authorized to create the target resource.

4.1.  RESTCONF Resource Types

   The RESTCONF protocol defines resource, an error
   response containing a set of application specific media
   types "403 Forbidden" or "404 Not Found" Status-Line
   is returned to identify each of the available resource types.  The
   following resource types client.  All other error responses are defined in RESTCONF:

                +-----------+----------------------------+
                | Resource  | Media Type                 |
                +-----------+----------------------------+
                | API       | application/yang.api       |
                | Datastore | application/yang.datastore |
                | Data      | application/yang.data      |
                | Errors    | application/yang.errors    |
                | Operation | application/yang.operation |
                | Schema    | application/yang           |
                | Stream    | application/yang.stream    |
                +-----------+----------------------------+
                           RESTCONF Media Types

4.2.  Resource Discovery

   A client SHOULD start by retrieving the top-level API resource, using
   the entry point URI handled
   according to the procedures defined in Section 3.2.

   The RESTCONF protocol does not include 6.

   Example:

   To create a resource discovery
   mechanism.  Instead, new "jukebox" resource, the definitions within client might send:

      POST /restconf/data HTTP/1.1
      Host: example.com
      Content-Type: application/yang.data+json

      { "example-jukebox:jukebox" : [null] }

   If the YANG modules
   advertised by resource is created, the server are used might respond as follows:

      HTTP/1.1 201 Created
      Date: Mon, 23 Apr 2012 17:01:00 GMT
      Server: example-server
      Location: http://example.com/restconf/data/example-jukebox:jukebox
      Last-Modified: Mon, 23 Apr 2012 17:01:00 GMT
      ETag: b3a3e673be2

   Refer to construct a predictable
   operation or data Appendix D.2.1 for more resource identifier.

   The "depth" query parameter can be used to control how many
   descendant levels should be included when retrieving child resources.
   This parameter can be used with creation examples.

3.4.2.  Invoke Operation Mode

   If the GET target resource type is an operation resource, then the POST
   method to discover child
   resources within is treated as a particular resource.

4.3.  API Resource request to invoke that operation.  The API resource contains message
   body (if any) is processed as the state and access points operation input parameters.  Refer
   to Section 2.6 for details on operation resources.

   If the
   RESTCONF features.  It POST request succeeds, a "200 OK" Status-Line is the top-level resource returned if
   there is a response message body, and has a "204 No Content" Status-Line
   is returned if there is no response message body.

   If the media
   type "application/yang.api+xml" user is not authorized to invoke the target operation, an
   error response containing a "403 Forbidden" or "application/yang.api+json".

   YANG Tree Diagram for "application/yang.api" Resource Type:

      +--rw restconf
         +--rw data
         +--rw modules
         |  +--rw module* [name revision]
         |     +--rw name         yang:yang-identifier
         |     +--rw revision     union
         |     +--rw schema?      empty
         |     +--rw namespace    inet:uri
         |     +--rw feature*     yang:yang-identifier
         |     +--rw deviation*   yang:yang-identifier
         |     +--rw submodule* [name revision]
         |        +--rw name        yang:yang-identifier
         |        +--rw revision    union
         |        +--rw schema?     empty
         +--rw operations
         +--rw streams
            +--rw stream* [name]
               +--rw name                        string
               +--rw description?                string
               +--rw replay-support?             boolean
               +--rw replay-log-creation-time?   yang:date-and-time
               +--rw events?                     empty

   The "restconf" container definition in the "ietf-restconf" module
   defined in Section 7 "404 Not Found"
   Status-Line is used returned to specify the structure and syntax of
   the conceptual child resources within the API resource.

   This resource has the following child resources:

            +----------------+--------------------------------+
            | Child Resource | Description                    |
            +----------------+--------------------------------+
            | data           | Contains all data resources    |
            | modules        | YANG module information        |
            | operations     | Data-model specific operations |
            | streams        | Notification event streams     |
            +----------------+--------------------------------+

                            RESTCONF Resources

4.3.1.  {+restconf}/data

   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  All other error responses are
   handled according to the client.  The datastore resource
   type is procedures defined in Section 4.4. 6.

   Example:

   This example request by

   In this example, the client would retrieve only the non-
   configuration data nodes that exist within is invoking the "library" resource,
   using "play" operation defined
   in the "content" query parameter.

      GET /restconf/data/example-jukebox:jukebox/library
         ?content=nonconfig "example-jukebox" YANG module.

   A client might send a "play" request as follows:

      POST /restconf/operations/example-jukebox:play   HTTP/1.1
      Host: example.com
      Accept: application/yang.data+json,
              application/yang.errors+json

   The server might respond:

      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+json application/yang.operation+json

      {
        "example-jukebox:library"
        "example-jukebox:input" : {
           "artist-count" : 42,
           "album-count"
          "playlist" : 59,
           "song-count" "Foo-One",
          "song-number" : 374 2
        }
      }

4.3.2.  {+restconf}/modules

   This mandatory resource contains the identifiers for the YANG data
   model modules supported by the server.

   The server MUST maintain a last-modified timestamp for this resource,
   and return the "Last-Modified" header when this resource might respond:

      HTTP/1.1 204 No Content
      Date: Mon, 23 Apr 2012 17:50:00 GMT
      Server: example-server

3.5.  PUT

   The PUT method is retrieved
   with sent by the GET client to create or HEAD methods.

   The server SHOULD maintain an entity-tag for this resource, and
   return replace the "ETag" header when this target
   resource.

   The only target resource media type that supports PUT is retrieved with the GET
   or HEAD methods.

4.3.2.1.  {+restconf}/modules/module

   This mandatory resource contains one list entry for each YANG data
   model module
   resource.  The message body is expected to contain the content used
   to create or replace the target resource.

   The "insert" (Section 3.8.5) and "point" (Section 3.8.6) query
   parameters are supported by the server.  There MUST be an instance of
   this resource PUT method for every YANG module that data resources.

   Consistent with [RFC2616], if the PUT request creates a new resource,
   a "201 Created" Status-Line is accessible via returned.  If an
   operation existing resource is
   modified, either "200 OK" or a data resource.

   The contents of "204 No Content" are returned.

   If the "module" user is not authorized to create or replace the target
   resource an error response containing a "403 Forbidden" or "404 Not
   Found" Status-Line is returned to the client.  All other error
   responses are handled according to the procedures defined in
   Section 6.

   Example:

   An "album" child resource defined in the "module" "example-jukebox" YANG list statement in Section 7.

   The server MAY maintain a last-modified timestamp for each instance
   of this resource, and return the "Last-Modified" header when this
   resource
   module is retrieved with the GET replaced or HEAD methods.  If created if it does not supported
   then the timestamp for already exist.

   To replace the parent "modules" "album" resource MAY be used
   instead.

   The server MAY maintain an entity-tag for each instance of this
   resource, and return contents, the "ETag" client might send as
   follows.  Note that the request URI header when this line is wrapped for
   display purposes only:

      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
        }
      }

   If the resource is
   retrieved with updated, the GET or HEAD methods.  If not supported then server might respond:

      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

3.6.  PATCH

   RESTCONF uses the
   timestamp HTTP PATCH method defined in [RFC5789] to provide
   an extensible framework for the parent "modules" resource MAY be used instead.

4.3.3.  {+restconf}/operations

   This optional resource patching mechanisms.  It is a container that provides access
   optional to implement by the
   data-model specific protocol operations server.  Each patch type needs a unique
   media type.  Zero or more PATCH media types MAY be supported by the
   server.  The
   server MAY omit this

   A plain patch is used to create or update a child resource if no data-model specific operations
   are advertised.

   Any data-model specific operations defined in within the YANG modules
   advertised by
   target resource.  If the target resource instance does not exist, the
   server MAY be available as child nodes of this
   resource.

   Operation resources are defined in Section 4.6.

4.3.4.  {+restconf}/streams

   This optional resource MUST NOT create it.

   If the PATCH request succeeds, a "200 OK" Status-Line is returned if
   there is a container that provides access to the
   notification event streams supported by the server.  The server MAY
   omit this resource message body, and "204 No Content" is returned if no notification event streams are supported.
   The media type for this resource
   response message body is "application/yang.api".

   The server will populate this container with a stream list entry for
   each stream type it supports.  Each stream contains a leaf called
   "events" which represents an event stream resource.  The media type
   for this resource sent.

   If the user is "application/yang.stream".

   Stream resources are defined in Section 4.8.  Notifications are
   defined in Section 5.

4.4.  Datastore Resource

   The "{+restconf}/data" subtree represents not authorized to alter the datastore target resource
   type, which is an error
   response containing a collection of configuration and operational data
   nodes.

   A "unified datastore" interface "403 Forbidden" or "404 Not Found" Status-Line
   is used returned to simplify resource editing
   for the client.  The RESTCONF unified datastore is a conceptual
   interface to the native configuration datastores that  All other error responses are present on
   the device.

   The underlying NETCONF datastores (i.e., candidate, running, startup)
   can be used to implement the unified datastore, but the server design
   is not limited handled
   according to the exact datastore procedures defined in NETCONF.

   The "candidate" and "startup" datastores are not visible Section 6.

   Example:

   To replace just the "year" field in the
   RESTCONF protocol.  Transaction management and configuration
   persistence are handled by "album" resource (instead of
   replacing the server and not controlled by the
   client.

   A datastore entire resource can only be written directly with the PATCH
   method.  Only the configuration data resources within PUT method), the datastore
   resource can be edited directly with all methods.

   Each RESTCONF edit of client might
   send a datastore resource is saved to non-volatile
   storage in an implementation-specific matter by the server.  There is
   no guarantee that configuration changes are saved immediately, or plain patch as follows.  Note that the saved configuration request URI header line
   is always a mirror of the running
   configuration.

4.4.1.  Edit Collision Detection

   Two "edit collision detection" mechanisms are provided in RESTCONF, wrapped for datastore and data resources.

4.4.1.1.  Timestamp

   The last change time is maintained and display purposes only:

      PATCH /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" : {
          "genre" : "example-jukebox:rock",
          "year" : 2011
        }
      }

   If the "Last-Modified" and "Date"
   headers are returned in field is updated, the response server might respond:

      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

   The XML encoding for a retrieval request. the same request might be:

      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

      <album xmlns="http://example.com/ns/example-jukebox">
         <genre>example-jukebox:rock</genre>
         <year>2011</year>
      </album>

3.7.  DELETE

   The
   "If-Unmodified-Since" header can be DELETE method is used in edit operation requests to cause delete the server to reject target resource.  If the
   DELETE request if the resource has been
   modified since the specified timestamp.

   The server MUST maintain succeeds, a last-modified timestamp for this resource, "204 No Content" Status-Line is returned,
   and return there is no response message body.

   If the "Last-Modified" header when this resource user is retrieved
   with the GET or HEAD methods.  Only changes not authorized to configuration data
   resources within the datastore affect this timestamp.

4.4.1.2.  Entity tag

   A unique opaque string is maintained and the "ETag" header is
   returned in delete the target resource then an
   error response for containing a retrieval request.  The "If-Match"
   header can be used in edit operation requests "403 Forbidden" or "404 Not Found"
   Status-Line is returned to cause the server client.  All other error responses are
   handled according to
   reject the request if the resource entity tag does not match the
   specified value.

   The server MUST maintain procedures defined in Section 6.

   Example:

   To delete a resource entity tag for this such as the "album" resource, and
   return the "ETag" header when this client might
   send:

      DELETE /restconf/data/example-jukebox:jukebox/
         library/artist=Foo%20Fighters/album=Wasting%20Light HTTP/1.1
      Host: example.com

   If the resource is retrieved with deleted, the GET server might respond:

      HTTP/1.1 204 No Content
      Date: Mon, 23 Apr 2012 17:49:40 GMT
      Server: example-server

3.8.  Query Parameters

   Each RESTCONF operation allows zero or HEAD methods.  The resource entity tag MUST be changed to a new
   previously unused value if changes more query parameters to any configuration data
   resources within be
   present in the datastore are made.

4.5.  Data Resource

   A data resource represents a YANG data node request URI.  The specific parameters that is a descendant node
   of a datastore resource.

   For configuration data resources, the server MAY maintain a last-
   modified timestamp for are allowed
   depends on the resource, resource type, and return the "Last-Modified"
   header when it is retrieved with the GET or HEAD methods.  If
   maintained, sometimes the specific target
   resource timestamp MUST be set to the current time
   whenever the resource or any configuration resource within the
   resource is altered.

   For configuration data resources, the server MAY maintain a resource
   entity tag for the resource, and return the "ETag" header when it is
   retrieved as the target resource with used, in the request.

   +------------+----------+-------------------------------------------+
   | Name       | Methods  | Description                               |
   +------------+----------+-------------------------------------------+
   | content    | 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.

   A      | Select config and/or non-config data resource can be retrieved with      |
   |            |          | resources                                 |
   | depth      | GET      | Request limited sub-tree depth in the     |
   |            |          | reply content                             |
   | filter     | GET method.  Data      | Boolean notification filter for event-    |
   |            |          | stream resources
   are accessed via the "{+restconf}/data" entry point.  This sub-tree
   is used to retrieve and edit                          |
   | insert     | POST,    | Insertion mode for user-ordered data resources.

   A configuration      |
   |            | PUT      | resources                                 |
   | point      | POST,    | Insertion point for user-ordered data resource can be altered by the client with some
   or all     |
   |            | PUT      | resources                                 |
   | select     | GET      | Request a subset of the edit operations, depending on the target resource and
   the specific operation.  Refer to Section 2   |
   |            |          | contents                                  |
   | start-time | GET      | Replay buffer start time for more details on edit
   operations.

   The resource definition version event-stream |
   |            |          | resources                                 |
   | stop-time  | GET      | Replay buffer stop time for a data resource is identified by
   the revision date of the YANG module containing event-stream  |
   |            |          | resources                                 |
   +------------+----------+-------------------------------------------+

                         RESTCONF Query Parameters

   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 YANG definition parameter is missing.

   Refer to Appendix D.3 for examples of query parameter usage.

   If vendors define additional query parameters, they SHOULD use a
   prefix (such as the data resource, specified in the "{+restconf}/modules" sub-
   tree.

4.5.1.  Encoding YANG Instance Identifiers enterprise or organization name) for query
   parameter names in the Request URI

   In YANG, data nodes are named order to avoid collisions with an absolute XPath expression, other parameters.

3.8.1.  Query Parameter URIs

   A new set of NETCONF Capability URNs are defined in [XPath] , starting from the document root to identify the target
   resource.  In RESTCONF, URL encoded Location header expressions are
   used instead.

   The YANG "instance-identifier" (i-i) data type is represented in
   RESTCONF with
   specific query parameters supported by the path expression format defined in this section.

           +-------+-------------------------------------------+ server.

       +---------+-------------------------------------------------+
       | Name    | Comments URI                                             |
           +-------+-------------------------------------------+
       +---------+-------------------------------------------------+
       | point content | Insertion point is always a full i-i urn:ietf:params:restconf:capability:content:1.0 |
       | path depth   | Request URI path is a full or partial i-i urn:ietf:params:restconf:capability:depth:1.0   |
           +-------+-------------------------------------------+
       | filter  | urn:ietf:params:restconf:capability:filter:1.0  |
       | insert  | urn:ietf:params:restconf:capability:insert:1.0  |
       | select  | urn:ietf:params:restconf:capability:select:1.0  |
       | replay  | urn:ietf:params:restconf:capability:replay:1.0  |
       +---------+-------------------------------------------------+

                       RESTCONF instance-identifier Type Conversion Query Parameter URIs

3.8.2.  The "path" component "content" Query Parameter

   The "content" parameter controls how descendant nodes of the request URI contains the absolute path
   expression that identifies the target resource.

   A predictable location for a
   requested data resource is important, since
   applications nodes will code to be processed in the YANG data model module, which uses
   static naming and defines an absolute path location for reply.

   The allowed values are:

    +-----------+-----------------------------------------------------+
    | Value     | Description                                         |
    +-----------+-----------------------------------------------------+
    | config    | Return only configuration descendant data nodes     |
    | nonconfig | Return only non-configuration descendant data nodes |
    | all       | Return all descendant data
   nodes.

   A RESTCONF nodes                    |
    +-----------+-----------------------------------------------------+

   This parameter is only allowed for GET methods on datastore and data resource identifier
   resources.  A 400 Bad Request error is not an XPath expression.  It returned if used for other
   methods or resource types.

   The default value is encoded from left to right, starting with the top-level data node,
   according to determined by the "api-path" rule in Section 4.5.1.1.  The node name
   of each ancestor "config" statement value of
   the target resource node requested data nodes.  If the "config" value is encoded in order,
   ending with "false", then the node name
   default for the target resource. "content" parameter is "nonconfig".  If a data node in the path expression "config" is a YANG list node,
   "true" then the
   key values default for the list (if any) "content" parameter is "config".

   If this query parameter is supported by the server, then the
   "content" query parameter URI MUST be encoded according to listed in the
   following rules.

   o "capability"
   leaf-list in Section 8.3.

3.8.3.  The key leaf values "depth" Query Parameter

   The "depth" 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 resource representing node itself.  Any child nodes which
   are contained within a YANG list
      MUST be encoded using one path segment [RFC3986].

   o  If there parent node have a depth value that is only one key leaf value, 1
   greater than its parent.

   The value of the path segment "depth" parameter is
      constructed by having the list name followed by either an "=" followed by
      the single key leaf value.

   o  If there are multiple key leaf values, integer between 1 and
   65535, or the value of each leaf
      identified in string "unbounded".  "unbounded" is the "key" statement default.

   This parameter is encoded in 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.

   By default, the order
      specified in server will include all sub-resources within a
   retrieved resource, which have the YANG "key" statement, same resource type as the
   requested resource.  Only one level of sub-resources with a comma separating
      them.

   o  All the components in different
   media type than the "key" statement MUST target resource will be encoded.
      Partial instance identifiers are not supported.

   o  Quoted strings are returned.

   If this query parameter is supported in by the key leaf values.  Quoted
      strings server, then the "depth"
   query parameter URI MUST be used to express empty strings. (example:
      list=foo,'',baz).

   o  The "list-instance" ABNF rule defined listed in Section 4.5.1.1
      represents the syntax of a list instance identifier.

   o  Resource URI values returned "capability" leaf-list in Location headers for data
      resources MUST identify the module name, even if there are no
      conflicting local names when the resource
   Section 8.3.

3.8.4.  The "select" Query Parameter

   The "select" query parameter is created.  This
      ensures used to optionally identify data
   nodes within the correct target resource will to be identified even if the server
      loads retrieved in a new module that the old GET method.
   The client does not know about.

   Examples:

      container top {
           list list1 {
           key "key1 key2 key3";
           ...
           list list2 {
               key "key4 key5";
               ...
               leaf X { type string; }
           }
       }

   For the above YANG definition, URI with key leaf values will be
   encoded as follows (line wrapped for display purposes only):

       /restconf/data/top/list1=key1val,key2val,key3val3/
          list2=key4val,key5val/X

4.5.1.1.  ABNF For Data Resource Identifiers

   The "api-path" ABNF syntax is used can use this parameter to construct RESTCONF path
   identifiers:

       api-path = "/"  |
                  ("/" api-identifier
                    0*("/" (api-identifier | list-instance )))

       api-identifier = [module-name ":"] identifier

       module-name = identifier

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

       key-value = string

       string = <a quoted or unquoted or empty string>

       ;; An identifier MUST NOT start with
       ;; (('X'|'x') ('M'|'m') ('L'|'l'))
       identifier retrieve a subset of all nodes
   in a resource.

   A value of the "select" query parameter matches the following rule:

     select-expr = (ALPHA / "_")
                     *(ALPHA / DIGIT path '(' select-expr / "_" '*' ')' / "-"
                   path ';' select-expr / ".")

4.5.2.  Defaults Handling

   NETCONF has a rather complex model for handling default values for
   leafs.  RESTCONF attempts
                   path
     path = api-identifier [ '/' path ]

   "api-identifier" is defined in Section 2.5.1.1.

   ";" is used to avoid this complexity by restricting the
   operations that can be applied select multiple nodes.  For example, to a resource.  Applications that
   require full control retrieve only
   the "genre" and "year" of defaults might consider NETCONF instead an album, use: "select=genre;year".

   Parentheses are used to specify sub-selectors of
   RESTCONF.

   If a node.  For
   example, to retrieve only the target "label" and "catalogue-number" of a GET method an
   album, use: "select=admin(label;catalogue-number)".

   "/" is used in a data node that represents path to retrieve a leaf
   that has child node of a default value, node.  For
   example, to retrieve only the "label" of an album, use:
   "select=admin/label".

   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.

   If this query parameter is supported by the leaf has not been given server, then the "select"
   query parameter URI MUST be listed in the "capability" leaf-list in
   Section 8.3.

3.8.5.  The "insert" Query Parameter

   The "insert" parameter is used to specify how a resource should be
   inserted within a user-ordered list.

   The allowed values are:

   +--------+----------------------------------------------------------+
   | Value  | Description                                              |
   +--------+----------------------------------------------------------+
   | first  | Insert the new data as the new first entry.              |
   | last   | Insert the new data as the new last entry.               |
   | before | Insert the new data before the insertion point, as       |
   |        | specified by the value
   yet, of the server MUST return "point" parameter.         |
   | after  | Insert the new data after the insertion point, as        |
   |        | specified by the value of the "point" parameter.         |
   +--------+----------------------------------------------------------+

   The default value that is in use by "last".

   This parameter is only supported for the
   server.

   If POST and PUT methods.  It is
   also only supported if the target of a GET method resource is a data node resource, and
   that data represents a
   container or YANG list or leaf-list that has any child resources with default values,
   for the child resources that have not been given value yet, is ordered by the
   server MAY return
   user.

   If the default values that "before" or "after" are in use by the server.

4.6.  Operation Resource

   An operation resource represents an protocol operation defined with used, then a "point" query
   parameter for the YANG "rpc" statement.

   All operation resources share the same module namespace as any top-
   level data resources, so the name of an operation resource cannot
   conflict with the name of insertion parameter MUST also be present, or a top-level data resource defined within
   the same module. 400
   Bad Request error is returned.

   If 2 different YANG modules define this query parameter is supported by the same "rpc" identifier, server, then the module name "insert"
   query parameter URI MUST be used listed in the request URI.  For example, if
   "module-A" and "module-B" both defined a "reset" operation, then
   invoking the operation from "module-A" would "capability" leaf-list in
   Section 8.3.  The "point" query parameter MUST also be requested as follows:

      POST /restconf/operations/module-A:reset HTTP/1.1
      Server example.com

   Any usage of an operation resource from the same module, with the
   same name, refers to supported by
   the same "rpc" statement definition.  This
   behavior can be server.

3.8.6.  The "point" Query Parameter

   The "point" parameter is used to design protocol operations that perform specify the
   same general function on different insertion point for a
   data resource types.

   If the "rpc" statement has an "input" section, then that is being created or moved within a message body
   MAY be sent by user ordered
   list or leaf-list.

   The value of the client "point" parameter is of type
   "data-resource-identifier", defined in the request, otherwise "ietf-restconf" YANG
   module Section 7.

   This parameter is only supported for the request
   message MUST NOT include POST and PUT methods.  It is
   also only supported if the target resource is a message body. data resource, and
   that data represents a YANG list or leaf-list that is ordered by the
   user.

   If the "rpc" statement has
   an "output" section, then "insert" query parameter is not present, or has a message body MAY value other
   than "before" or "after", then a 400 Bad Request error is returned.

   This parameter contains the instance identifier of the resource to be sent by
   used as the insertion point for a POST or PUT method.

   If the server includes the "insert" query parameter URI in the response.  Otherwise
   "capability" leaf-list in Section 8.3, then the server "point" query
   parameter MUST NOT include be supported.

3.8.7.  The "filter" Query Parameter

   The "filter" 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.

   This parameter is only allowed for GET methods on a message body text/event-stream
   data resource.  A 400 Bad Request error is returned if used for other
   methods or resource types.

   The format of this parameter is an XPath 1.0 expression, and is
   evaluated in the response message, following context:

   o  The set of namespace declarations is the set of prefix and MUST send a "204 No Content" Status-Line
   instead.

4.6.1.  Encoding Operation Input Parameters

   If
      namespace pairs for all supported YANG modules, where the "rpc" statement has an "input" section, then prefix
      is the "input" node YANG module name, and the namespace is provided in as defined by the message body, corresponding to
      "namespace" statement in the YANG data
   definition statements within module.

   o  The function library is the "input" section.

   Example: core function library defined in XPath
      1.0.

   o  The following YANG definition set of variable bindings is empty.

   o  The context node is used for the examples root node.

   The filter is used as defined in this
   section.

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

   The client might send the following POST request message:

      POST /restconf/operations/example-ops:reboot HTTP/1.1
      Host: example.com
      Content-Type: application/yang.operation+json

      {
        "example-ops:input" : {
          "delay" : 600,
          "message" : "Going down for system maintenance",
          "language" : "en-US"
        }
      }

   The server might respond:

      HTTP/1.1 204 No Content
      Date: Mon, 25 Apr 2012 11:01:00 GMT
      Server: example-server

4.6.2.  Encoding Operation Output Parameters [RFC5277], section 3.6.  If the "rpc" statement has an "output" section,
   boolean result of the expression is true when applied to the
   conceptual "notification" document root, then the "output"
   node notification event
   is provided delivered to the client.

   If this query parameter is supported by the server, then the "filter"
   query parameter URI MUST be listed in the message body, corresponding "capability" leaf-list in
   Section 8.3.

3.8.8.  The "start-time" Query Parameter

   The "start-time" parameter is used to trigger the YANG data
   definition statements within notification replay
   feature and indicate that the "output" section.

   Example: replay should start at the time
   specified.  If the stream does not support replay, per the
   "replay-support" attribute returned by the /restconf/streams
   resource, then the server MUST return the HTTP error code 400 Bad
   Request.

   The following value of the "start-time" parameter is of type "date-and-time",
   defined in the "ietf-yang" YANG definition module [RFC6991].

   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 the examples in other
   methods or resource types.

   If this
   section.

       rpc get-reboot-info {
         output {
           leaf reboot-time {
             units seconds;
             type uint32;
           }
           leaf message { type string; }
           leaf language { type string; }
         }
       }

   The client might send 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 following POST request message:

      POST /restconf/operations/example-ops:get-reboot-info HTTP/1.1
      Host: example.com
      Accept: application/yang.operation+json,
              application/yang.errors+json

   The server might respond:

      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"
        }
      }

4.7.  Schema Resource current time.  If the server supports the "schema" leaf within the API then value specified is earlier than
   the
   client log can retrieve support, the YANG schema text for replay will begin with the associated YANG
   module or submodule, using earliest
   available notification.

   If this query parameter is supported by the GET method.

   The client might send server, then the following GET request message:

      GET /restconf/modules/module=example-jukebox,2014-07-03/schema
         HTTP/1.1
      Host: example.com
      Accept: application/yang,
              application/yang.errors+json "replay"
   query parameter URI MUST be listed in the "capability" leaf-list in
   Section 8.3.  The server might respond:

      HTTP/1.1 200 OK
      Date: Mon, 25 Apr 2012 11:10:30 GMT
      Server: example-server
      Content-Type: application/yang

      module example-jukebox {

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

         // rest of YANG module content deleted...
      }

4.8.  Stream Resource

   A "stream" resource represents a source for system generated event
   notifications.  Each stream is created and modified "stop-time" query parameter MUST also be supported
   by the server
   only.  A client can retrieve a stream resource or initiate a long-
   poll server sent event stream, using server.

   If the procedure specified "replay-support" leaf is present in the "stream" entry
   (defined in Section 5.3.

   A notification stream functions according to 8.3) then the NETCONF
   Notifications specification [RFC5277]. server MUST support the
   "start-time" and "stop-time" query parameters for that stream.

3.8.9.  The "ietf-restconf" YANG
   module contains "stop-time" Query Parameter

   The "stop-time" parameter is used with the "stream" list ("{+restconf}/streams/stream")
   which specifies replay feature to indicate
   the syntax newest notifications of interest.  This parameter MUST be used
   with and semantics have a value later than the "start-time" parameter.

   The value of the "stop-time" parameter is of type "date-and-time",
   defined in the "ietf-yang" YANG module [RFC6991].

   This parameter is only allowed for GET methods on a stream text/event-stream
   data resource.

4.9.  Errors Resource

   An "errors"  A 400 Bad Request error is returned if used for other
   methods or resource types.

   If this parameter is a collection of error information that not present, the notifications will continue
   until the subscription is
   sent as terminated.  Values in the message body future are
   valid.

   If this query parameter is supported by the server, then the "replay"
   query parameter URI MUST be listed in a server response message, if an error
   occurs while processing a request message. the "capability" leaf-list in
   Section 8.3.  The "ietf-restconf" YANG module contains "start-time" query parameter MUST also be supported
   by the "errors" grouping which
   specifies server.

   If the syntax and semantics of an errors resource.  RESTCONF
   error handling behavior "replay-support" leaf is defined present in the "stream" entry
   (defined in Section 6.

5.  Notifications 8.3) then the server MUST support the
   "start-time" and "stop-time" query parameters for that stream.

4.  Messages

   The RESTCONF protocol supports YANG-defined event notifications.  The
   solution preserves aspects of NETCONF Event Notifications [RFC5277]
   while utilizing the Server-Sent Events [wd-eventsource] transport
   strategy.

5.1.  Server Support uses HTTP entities for messages.  A RESTCONF server is not required single HTTP
   message corresponds to support RESTCONF notifications.
   Clients may determine if a server supports RESTCONF notifications by
   using the HTTP operation OPTIONS, HEAD, or GET single protocol method.  Most messages can
   perform a single task on the "{+restconf}/
   streams" a single resource, such as retrieving a
   resource described below. or editing a resource.  The server does not support
   RESTCONF notifications if an HTTP error code exception is returned (e.g., 404
   Not Found).

5.2.  Event Streams

   A RESTCONF server that supports notifications will populate the PATCH method,
   which allows multiple datastore edits within a stream
   resource single message.

4.1.  Request URI Structure

   Resources are represented with URIs following the structure for each notification delivery service access point.
   generic URIs in [RFC3986].

   A RESTCONF client can retrieve the list of supported event streams operation is derived from
   a RESTCONF server the HTTP method and the request
   URI, using the GET following conceptual fields:

        <OP> /<restconf>/<path>?<query>#<fragment>

         ^       ^        ^       ^         ^
         |       |        |       |         |
       method  entry  resource  query    fragment

         M       M        O        O         I

       M=mandatory, O=optional, I=ignored

       <text> replaced by client with real values

   o  method: the HTTP method identifying the RESTCONF operation on
      requested by the "{+restconf}/
   streams" resource.

   The "{+restconf}/streams" container definition client, to act upon the target resource specified
      in the "ietf-restconf"
   module defined request URI.  RESTCONF operation details are described in
      Section 7 is used to specify 3.

   o  entry: the structure and
   syntax root of the conceptual child resources within RESTCONF API configured on this HTTP
      server, discovered by getting the "streams"
   resource.

   For example:

   The client might send ".well-known/host-meta"
      resource, as described in Section 4.2.  All of the following request:

      GET /restconf/streams HTTP/1.1
      Host: example.com
      Accept: application/yang.api+xml,
              application/yang.errors+xml

   The server might send examples in
      this document assume "/restconf" as the following response:

      HTTP/1.1 200 OK
      Content-Type: application/yang.api+xml
      <streams xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
         <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>
            <events/>
         </stream>
         <stream>
            <name>SNMP</name>
            <description>SNMP notifications</description>
            <replay-support>false</replay-support>
            <events/>
         </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>
            <events/>
         </stream>
      </streams>

5.3.  Subscribing to Receive Notifications discovered RESTCONF clients can subscribe API
      root path.  The URI template [RFC6570] syntax "{+restconf}" is
      used to receive notifications by sending refer to the entry point outside of an
   HTTP GET request for example.

   o  resource: the "{+restconf}/streams/stream/<stream-name>"
   resource, with path expression identifying the "Accept" type "text/event-stream".  The server
   will treat resource that is
      being accessed by the connection as an event stream, using operation.  If this field is not present,
      then the Server Sent
   Events [wd-eventsource] transport strategy.

   The server MAY support query target resource is the API itself, represented by the
      media type "application/yang.api".

   o  query: the set of parameters for a GET method on this
   resource. associated with the RESTCONF message.
      These have the familiar form of "name=value" pairs.  All query
      parameters are specific optional to each notification stream.

   For example:

      GET /restconf/streams/stream=NETCONF/events HTTP/1.1
      Host: example.com
      Accept: text/event-stream
      Cache-Control: no-cache
      Connection: keep-alive

   A RESTCONF client MAY request implement by the server compress the events using and optional to
      use by the HTTP header field "Accept-Encoding".  For instance:

      GET /restconf/streams/stream=NETCONF/events HTTP/1.1
      Host: example.com
      Accept: text/event-stream
      Cache-Control: no-cache
      Connection: keep-alive
      Accept-Encoding: gzip, deflate

5.3.1.  NETCONF Event Stream client.  Each query parameter is identified by a URI.
      The server SHOULD support MUST list the "NETCONF" notification stream query parameter URIs it supports in the
      "capabilities" list defined in [RFC5277].  For this stream, RESTCONF notification subscription
   requests MAY specify Section 8.3.

   There is a specific set of parameters indicating defined, although the events it wishes server
   MAY choose to
   receive.

                 +------------+-------------------------+
                 | Name       | Description             |
                 +------------+-------------------------+
                 | start-time | replay event start time |
                 | stop-time  | replay event stop time  |
                 | filter     | boolean content filter  |
                 +------------+-------------------------+

                      NETCONF Stream Query Parameters

   The semantics and syntax for these support query parameters are not defined in
   the "query-parameters" YANG grouping in Section 7. this document.
   The YANG encoding contents of the any query parameter value MUST be converted to URL-encoded string for use in the request URI.

   Refer encoded
   according to Appendix D.3.3 for filter parameter examples.

5.4.  Receiving Event Notifications

   RESTCONF notifications are [RFC2396], section 3.4.  Any reserved characters MUST be
   encoded with escape sequences, according to the definition of the
   event stream.  The NETCONF stream defined in [RFC5277] [RFC2396], section 2.4.

   o  fragment: This field is encoded in
   XML format.

   The structure of not used by the event data RESTCONF protocol.

   When new resources are created by the client, a "Location" header is based on
   returned, which identifies the "notification"
   element definition in section 4 path of [RFC5277].  It the newly created resource.
   The client MUST conform use this exact path identifier to access the
   "notification" YANG container definition in Section 7.

   An example SSE notification encoded using XML:

      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:       <eventClass>fault</eventClass>
      data:       <reportingEntity>
      data:           <card>Ethernet0</card>
      data:       </reportingEntity>
      data:       <severity>major</severity>
      data:     </event>
      data: </notification>

   Since XML resource
   once it has been created.

   The "target" of an operation is not whitespace sensitive, a resource.  The "path" field in the above message can be
   encoded onto a single line.

   For example: ('\' line wrapping added
   request URI represents the target resource for formatting only)

      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"><eventClass>fault</eventClass><repo\
      rtingEntity><card>Ethernet0</card></reportingEntity><severity>maj\
      or</severity></event></notification>

   The SSE specifications supports the following additional fields:
   event, id and retry.  A operation.

4.2.  RESTCONF server MAY send Path Resolution

   In line the "retry" field
   and, if it does, RESTCONF clients SHOULD use it.  A best practices defined by [get-off-my-lawn], RESTCONF server
   SHOULD NOT send
   enables deployments to specify where the "event" or "id" fields, as there are no
   meaningful values that could be used for them that would not be
   redundant RESTCONF API is located.
   When first connecting to a RESTCONF server, a RESTCONF client MUST
   determine the contents root of the notification itself. RESTCONF
   servers that do not send API.  The client discovers this by
   getting the "id" field also do not need to support "/.well-known/host-meta" resource ([RFC6415]) and using
   the HTTP header "Last-Event-Id".  RESTCONF servers that do send <Link> element containing the
   "id" field MUST still support "restconf" attribute :

      Request
      -------
      GET /.well-known/host-meta users HTTP/1.1
      Host: example.com
      Accept: application/xrd+xml

      Response
      --------
      HTTP/1.1 200 OK
      Content-Type: application/xrd+xml
      Content-Length: nnn
      <XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
          <Link rel='restconf' href='/restconf'/>
      </XRD>

   Once discovering the "startTime" query parameter as RESTCONF API root, the
   preferred means for a client MUST prepend it to specify where to restart the event
   stream.

6.  Error Reporting

   HTTP Status-Lines are used
   any subsequent request to report success or failure for a RESTCONF
   operations.  The <rpc-error> 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
   "4xx" class of status codes. resource.  For instance, using
   the "/restconf" path discovered above, the client can now determine
   the operations supported by the the server:

      Request
      -------
      GET /restconf/operations  HTTP/1.1
      Host: example.com
      Accept: application/yang.api+json,
              application/yang.errors+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" : { "play" : [ null ] } }

4.3.  Message Headers

   There are several HTTP header lines utilized in RESTCONF messages.
   Messages are not limited to the HTTP headers listed in this section.

   HTTP defines which header lines are required for particular
   circumstances.  Refer to each operation definition section in
   Section 3 for examples on how particular headers are used.

   There are some request headers that are used within RESTCONF, usually
   applied to data resources.  The following table summarizes tables summarize the return status codes used
   specifically by
   headers most relevant in RESTCONF operations:

   +---------------------------+---------------------------------------+ message requests:

   +---------------------+---------------------------------------------+
   | Status-Line Name                | Description                                 |
   +---------------------------+---------------------------------------+
   +---------------------+---------------------------------------------+
   | 100 Continue Accept              | POST accepted, 201 should follow Response Content-Types that are acceptable  |
   | 200 OK Content-Type        | Success with response The media type of the request body          |
   | 201 Created Host                | POST to create a resource success The host address of the server              |
   | 202 Accepted If-Match            | POST to create a resource accepted Only perform the action if the entity       |
   | 204 No Content                     | Success without response body matches ETag                                |
   | 304 Not Modified If-Modified-Since   | Conditional operation not done Only perform the action if modified since   |
   | 400 Bad Request                     | Invalid request message time                                        |
   | 403 Forbidden If-Unmodified-Since | Access to resource denied             |
   | 404 Not Found             | Resource target or resource node not  |
   |                           | found                                 |
   | 405 Method Not Allowed    | Method not allowed for target Only perform the action if un-modified      |
   |                     | resource since time                                  |
   +---------------------+---------------------------------------------+

                         RESTCONF Request Headers

   The following tables summarize the headers most relevant in RESTCONF
   message responses:

   +---------------+---------------------------------------------------+
   | 409 Conflict Name          | Resource or lock in use Description                                       |
   +---------------+---------------------------------------------------+
   | 412 Precondition Failed Allow         | Conditional method is false Valid actions when 405 error returned             |
   | 413 Request Entity Too Cache-Control | too-big error The cache control parameters for the response     |
   | Large Content-Type  | The media type of the response body               |
   | 414 Request-URI Too Large Date          | too-big error The date and time the message was sent            |
   | 415 Unsupported Media ETag          | non RESTCONF media type An identifier for a specific version of a         |
   | Type               | resource                                          |
   | 500 Internal Server Error Last-Modified | operation-failed The last modified date and time of a resource     |
   | 501 Not Implemented Location      | unknown-operation The resource identifier for a newly created       |
   | 503 Service Unavailable               | Recoverable server error resource                                          |
   +---------------------------+---------------------------------------+
   +---------------+---------------------------------------------------+

                         RESTCONF Response Headers

4.4.  Message Encoding

   RESTCONF messages are encoded in HTTP Status Codes according to RFC 2616.  The
   "utf-8" character set is used in for all messages.  RESTCONF

   Since an operation resource message
   content is defined with a YANG "rpc" statement, a
   mapping between the NETCONF <error-tag> value and sent in the HTTP status
   code message body.

   Content is needed.  The specific error condition and response code to
   use are data-model specific and might be contained encoded in the YANG
   "description" statement either JSON or XML format.

   XML encoding rules for the "rpc" statement.

                 +-------------------------+-------------+
                 | <error-tag>             | status code |
                 +-------------------------+-------------+
                 | in-use                  | 409         |
                 | invalid-value           | 400         |
                 | too-big                 | 413         |
                 | missing-attribute       | 400         |
                 | bad-attribute           | 400         |
                 | unknown-attribute       | 400         |
                 | bad-element             | 400         |
                 | unknown-element         | 400         |
                 | unknown-namespace       | 400         |
                 | access-denied           | 403         |
                 | lock-denied             | 409         |
                 | resource-denied         | 409         |
                 | rollback-failed         | 500         |
                 | data-exists             | 409         |
                 | data-missing            | 409         |
                 | operation-not-supported | 501         |
                 | operation-failed        | 500         |
                 | partial-operation       | 500         |
                 | malformed-message       | 400         |
                 +-------------------------+-------------+

                   Mapping from error-tag to status code

6.1.  Error Response Message

   When an error occurs for a request message on a data resource or an
   operation resource, nodes are defined in [RFC6020].  The same
   encoding rules are used for all XML content.

   JSON encoding rules are defined in [I-D.lhotka-netmod-json].  This
   encoding is valid JSON, but also has special encoding rules to
   identify module namespaces and a "4xx" class provide consistent type processing of status codes (except for
   status code "403 Forbidden"), then
   YANG data.

   Request input content encoding format is identified with the server SHOULD send Content-
   Type header.  This field MUST be present if a response message body containing the information described is sent by
   the "errors" container
   definition within client.

   Response output content encoding format is identified with the YANG module Section 7.  The Content-Type of
   this response message MUST be application/yang.errors.

   YANG Tree Diagram for <errors> Data:

      +--ro errors
         +--ro error
            +--ro error-type       enumeration
            +--ro error-tag        string
            +--ro error-app-tag?   string
            +--ro (error-node)?
            |  +--:(error-path)
            |  |  +--ro error-path?      instance-identifier
            |  +--:(error-urlpath)
            |     +--ro error-urlpath?   data-resource-identifier
            +--ro error-message?   string
            +--ro error-info Accept
   header in the request, or if is not specified, the request input
   encoding format is used.  If there was no request input, then the
   default output encoding is XML.  File extensions encoded in the
   request are not used to identify format encoding.

4.5.  RESTCONF Meta-Data

   The semantics and syntax for RESTCONF error messages 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 "errors" YANG grouping schema because it applies to the datastore, and
   is common across all data nodes.

   This information is encoded as attributes in Section 7.

   Examples:

   The following example shows an error XML.  JSON encoding of
   meta-data is defined in [I-D.lhotka-netmod-json].

4.6.  Return Status

   Each message represents some sort of resource access.  An HTTP
   "Status-Line" header line is returned for an "lock-denied"
   error on each request.  If a datastore resource.

      POST /restconf/operations/example-ops:lock-datastore HTTP/1.1
      Host: example.com

   The server might respond:

      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"
          }
        }
      }

   The following example shows an error 4xx or
   5xx range status code is returned for a "data-exists" in the Status-Line, then the error on a data resource.  The "jukebox" resource already exists so
   it cannot
   information will be created.

   The client might send:

      POST /restconf/data/example-jukebox:jukebox HTTP/1.1
      Host: example.com

   The server might respond:

      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": "data-exists",
            "error-urlpath": "http://example.com/restconf/data/
                 example-jukebox:jukebox",
            "error-message":
              "Data already exists, cannot create new resource"
          }
        }
      }

7.  RESTCONF module

   The "ietf-restconf" module defines conceptual definitions within
   groupings, which are not meant returned in the response, according to be implemented as the format
   defined in Section 6.1.

4.7.  Message Caching

   Since the datastore contents by change at unpredictable times, responses
   from a server. RESTCONF server generally SHOULD NOT be cached.

   The "ietf-yang-types" and "ietf-inet-types" modules from [RFC6991]
   are used by this module for some type definitions.

   RFC Ed.: update the date below with the date of RFC publication and
   remove this note.

   <CODE BEGINS> file "ietf-restconf@2014-07-03.yang"

   module ietf-restconf {
     namespace "urn:ietf:params:xml:ns:yang:ietf-restconf";
     prefix "rc";

     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: Bert Wijnen
                  <mailto:bertietf@bwijnen.net>

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

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

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

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

        Editor:   Rex Fernando
                  <mailto:rex@cisco.com>";

     description
       "This module contains conceptual YANG specifications
        for the message and error content that is used server SHOULD include a "Cache-Control" header in
        RESTCONF protocol messages. every response
   that specifies whether the response should be cached.  A conceptual container
        representing "Pragma"
   header specifying "no-cache" MAY also be sent in case the RESTCONF API nodes
   "Cache-Control" header is also defined
        for not supported.

   Instead of using HTTP caching, the media type application/yang.api.

        Note that client SHOULD track the YANG definitions within this module do not
        represent configuration data of any kind.
        The YANG grouping statements provide a normative syntax "ETag"
   and/or "Last-Modified" headers returned by the server for XML and JSON message encoding purposes.

        Copyright (c) 2014 IETF Trust and the persons identified as
        authors of
   datastore resource (or data resource if the code.  All rights reserved.

        Redistribution and use in source and binary forms, with server supports it).  A
   retrieval request for a resource can include the "If-None-Match" and/
   or
        without modification, is permitted pursuant to, and subject
        to "If-Modified-Since" headers, which will cause the license terms contained in, server to return
   a "304 Not Modified" Status-Line if the Simplified BSD License
        set forth in Section 4.c of resource has not changed.
   The client MAY use the IETF Trust's Legal Provisions
        Relating HEAD method 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-01.txt

     // RFC Ed.: update retrieve just the date below with message
   headers, which SHOULD include the date of RFC publication
     // "ETag" and remove "Last-Modified" headers,
   if this note.
     revision 2014-07-03 {
       description
         "Initial revision.";
       reference
         "RFC XXXX: meta-data is maintained for the target resource.

5.  Notifications

   The RESTCONF Protocol.";
     }

     typedef data-resource-identifier {
       type string {
         length "1 .. max";
       }
       description
         "Contains a Data Resource Identifier formatted string
          to identify a specific data resource instance. protocol supports YANG-defined event notifications.  The document root for all data resources
   solution preserves aspects of NETCONF Event Notifications [RFC5277]
   while utilizing the Server-Sent Events [wd-eventsource] transport
   strategy.

5.1.  Server Support

   A RESTCONF server is not required to support RESTCONF notifications.
   Clients may determine if a
          datastore resource container. Each top-level YANG
          data nodes supported server supports RESTCONF notifications by
   using the server will be represented
          as a child node of HTTP operation OPTIONS, HEAD, or GET on the document root.

          The canonical representation of a data
   "{+restconf}/streams" resource identifier
          includes the full described below.  The server specification that does not
   support RESTCONF notifications if an HTTP error code is returned
          in the Location header when
   (e.g., 404 Not Found).

5.2.  Event Streams

   A RESTCONF server that supports notifications will populate a new data stream
   resource is created
          with for each notification delivery service access point.  A
   RESTCONF client can retrieve the POST method.

          The abbreviated representation does not contain any list of supported event streams from
   a RESTCONF server
          location identification. Instead the identifier will start
          with the '/' character to represent using the datastore document
          root for GET operation on the "restconf-state/
   streams" data resource instance. defined in Section 8.3.

   The server MUST accept either representation and SHOULD
          return the canonical representation "restconf-state/streams" container definition in any response message.";
       reference
         "RFC XXXX: [sec. 5.3.1.1 ABNF For Data Resource Identifiers]";
     }

     typedef revision-identifier {
       type string {
         pattern '\d{4}-\d{2}-\d{2}';
       }
       description
         "Represents a specific date the
   "ietf-restconf-monitoring" module (defined in YYYY-MM-DD format.
          TBD: make pattern more precise Section 8.3) is used to exclude leading zeros.";
     }

     grouping errors {

       description
         "A grouping that contains a YANG container
          representing
   specify the syntax structure and semantics syntax of a
          YANG Patch errors report the conceptual child resources
   within a response message.";

       container errors {
         description
           "Represents the "streams" resource.

   For example:

   The client might send the following request:

      GET /restconf/data/restconf-state/streams HTTP/1.1
      Host: example.com
      Accept: application/yang.data+xml,
              application/yang.errors+xml

   The server might send the following response:

      HTTP/1.1 200 OK
      Content-Type: application/yang.api+xml
      <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>
            <events>http://example.com/streams/NETCONF</events>
         </stream>
         <stream>
            <name>SNMP</name>
            <description>SNMP notifications</description>
            <replay-support>false</replay-support>
            <events>http://example.com/streams/SNMP</events>
         </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>
            <events>http://example.com/streams/syslog-critical</events>
         </stream>
      </streams>

5.3.  Subscribing to Receive Notifications

   RESTCONF clients can determine the URL for the subscription resource
   (to receive notifications) by sending an error report HTTP GET request for the
   "{+restconf}/streams/stream/<stream-name>/events" data resource.

   The value 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 can be used for the actual
   notification layer";
               }
               enum protocol {
                 description "The protocol operation layer";
               }
               enum application {
                 description "The subscription.

   The client will send an HTTP GET request for the URL returned by the
   server application layer";
               }
             }
             mandatory true;
             description
               "The protocol layer where with the error occurred.";
           }

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

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

           choice error-node {
             description
               "The "text/event-stream".

   The server will return the location of treat the error node
                in a format that is appropriate for connection as an event stream, using the protocol.
                If no
   Server Sent Events [wd-eventsource] transport strategy.

   The server MAY support query parameters for a GET method on this
   resource.  These parameters are specific node within to each notification stream.

   For example:

   The client might send the request message body
                caused following request:

      GET /restconf/data/restconf-state/streams/stream=NETCONF/events
         HTTP/1.1
      Host: example.com
      Accept: application/yang.data+xml,
              application/yang.errors+xml

   The server might send the error following response:

      HTTP/1.1 200 OK
      Content-Type: application/yang.api+xml

      <ietf-restconf-monitoring:events
        xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring">
        http://example.com/streams/NETCONF
      </events>

   The RESTCONF client can then use this choice will not be present.";

             leaf error-path {
               type instance-identifier;
               description
                 "The YANG instance identifier associated
                  with the error node. This leaf will only be
                  present if the error node is not a data resource,
                  e.g., URL value to start monitoring
   the error node is an input parameter
                  for an operation resource.";
             }
             leaf error-urlpath {
               type data-resource-identifier;
               description
                 "The target data resource identifier associated
                  with event stream:

      GET /streams/NETCONF HTTP/1.1
      Host: example.com
      Accept: text/event-stream
      Cache-Control: no-cache
      Connection: keep-alive

   A RESTCONF client MAY request the error node.  This leaf will only be
                  present if server compress the error node is associated with
                  a data resource (either within events using
   the HTTP header field "Accept-Encoding".  For instance:

      GET /streams/NETCONF HTTP/1.1
      Host: example.com
      Accept: text/event-stream
      Cache-Control: no-cache
      Connection: keep-alive
      Accept-Encoding: gzip, deflate

5.3.1.  NETCONF Event Stream

   The server or
                  in SHOULD support the request message).";
             }
           }

           leaf error-message {
             type string;
             description
               "A message describing "NETCONF" notification stream defined
   in [RFC5277].  For this stream, RESTCONF notification subscription
   requests MAY specify parameters indicating the error.";
           }

           anyxml error-info {
              description
                "Arbitrary XML that represents a container
                 of additional information for events it wishes to
   receive.  These query parameters are optional to implement, and only
   available if the error report.";
           }
         }
       }
     } // grouping errors

     grouping restconf {
       description
         "A server supports them.

                 +------------+-------------------------+
                 | Name       | Description             |
                 +------------+-------------------------+
                 | start-time | replay event start time |
                 | stop-time  | replay event stop time  |
                 | filter     | boolean content filter  |
                 +------------+-------------------------+

                      NETCONF Stream Query Parameters

   The semantics and syntax for these query parameters are defined in
   the "query-parameters" YANG grouping that contains a in Section 7.  The YANG container
          representing the syntax and semantics of encoding
   MUST be converted to URL-encoded string for use in the request URI.

   Refer to Appendix D.3.6 for filter parameter examples.

5.4.  Receiving Event Notifications

   RESTCONF API resource.";

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

         container data {
           description
             "Container representing the application/yang.datastore
              resource type. Represents notifications are encoded according to the conceptual root definition of all
              operational data and configuration data supported by the server.
   event stream.  The child nodes of this container can be
              any data resource (application/yang.data), which are NETCONF stream defined as top-level data nodes from in [RFC5277] is encoded in
   XML format.

   The structure of the YANG modules
              advertised by event data is based on the server "notification"
   element definition in /restconf/modules.";
         }
         container modules {
           description
             "Contains a list section 4 of module description entries.
              These modules are currently loaded into [RFC5277].  It MUST conform to the server.";

           grouping common-leafs {
             description
               "Common parameters for YANG modules and submodules.";

             leaf name {
               type yang:yang-identifier;
               description "The YANG module or submodule name.";
             }
             leaf revision {
               type union {
                 type revision-identifier;
                 type string { length 0; }
               }
               description
                 "The
   "notification" YANG module or submodule revision date. container definition in Section 7.

   An empty string is used if no revision statement example SSE notification encoded using XML:

      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:       <eventClass>fault</eventClass>
      data:       <reportingEntity>
      data:           <card>Ethernet0</card>
      data:       </reportingEntity>
      data:       <severity>major</severity>
      data:     </event>
      data: </notification>

   Since XML is present in the YANG module or submodule.";
             }

             leaf schema {
               type empty;
               description
                 "Represents not whitespace sensitive, the YANG schema resource above message can be
   encoded onto a single line.

   For example: ('\' line wrapping added for this module
                  or submodule formatting only)
      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"><eventClass>fault</eventClass><repo\
      rtingEntity><card>Ethernet0</card></reportingEntity><severity>maj\
      or</severity></event></notification>

   The SSE specifications supports the following additional fields:
   event, id and retry.  A RESTCONF server MAY send the "retry" field
   and, if it is available on does, RESTCONF clients SHOULD use it.  A RESTCONF server
   SHOULD NOT send the server.
                  This leaf will only "event" or "id" fields, as there are no
   meaningful values that could be present if used for them that would not be
   redundant to the server has contents of the schema available for retrieval.  A GET
                  request with a target resource URI notification itself.  RESTCONF
   servers that identifies
                  this leaf will cause do not send the server "id" field also do not need to return support
   the YANG
                  schema text for HTTP header "Last-Event-Id".  RESTCONF servers that do send the associated module or submodule.";
             }
           }

           list module {
             key "name revision";
             description
               "Each entry represents one module currently
                supported by
   "id" field MUST still support the server.";

             uses common-leafs;

             leaf namespace {
               type inet:uri;
               mandatory true;
               description
                 "The XML namespace identifier "startTime" query parameter as the
   preferred means for this module.";
             }
             leaf-list feature {
               type yang:yang-identifier;
               description
                 "List of YANG feature names from this module that are
                  supported by a client to specify where to restart the server.";
             }
             leaf-list deviation {
               type yang:yang-identifier;
               description
                 "List of YANG deviation module names event
   stream.

6.  Error Reporting

   HTTP Status-Lines are used by this
                  server to modify the conformance of the module
                  associated with this entry.";
             }

             list submodule {
               key "name revision";
               description
                 "Each entry represents one submodule within the
                  parent module.";

               uses common-leafs;
             }
           }
         }

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

              Each resource RESTCONF
   operations.  The <rpc-error> element returned in NETCONF error
   responses contains some useful information.  This error information
   is represented as an empty leaf with the
              name adapted for use in RESTCONF, and error information is returned for
   "4xx" class of status codes.

   The following table summarizes the RPC operation from the YANG rpc statement.

              E.g.;

                 POST /restconf/operations/show-log-errors

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

         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 return status codes used
   specifically 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";
               reference
                 "RFC 5277, Section 3.4, <replaySupport> element.";
             }

             leaf replay-log-creation-time {
               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.";
             }

             leaf events {
               type empty;
               description
                 "Represents the entry point for establishing
                  notification delivery via server sent events.";

             }
           }
         }

       }
     }  // grouping restconf

     grouping query-parameters {
       description
          "Contains conceptual definitions for the query string
           parameters used in the RESTCONF protocol.";

       leaf content {
         type enumeration {
           enum config {
             description
               "Return only configuration descendant data nodes";
           }
           enum nonconfig {
             description
               "Return only non-configuration descendant data nodes";
           }
           enum all {
             description
               "Return all descendant data nodes";
           }
         }
         description
            "The content parameter controls how descendant nodes of
             the requested data nodes will be processed in the reply.

             This parameter is only allowed for GET methods on
             datastore and data resources.  A operations:

   +---------------------------+---------------------------------------+
   | Status-Line               | Description                           |
   +---------------------------+---------------------------------------+
   | 100 Continue              | POST accepted, 201 should follow      |
   | 200 OK                    | Success with response body            |
   | 201 Created               | POST to create a resource success     |
   | 202 Accepted              | POST to create a resource accepted    |
   | 204 No Content            | Success without response body         |
   | 304 Not Modified          | Conditional operation not done        |
   | 400 Bad Request error
             is returned if used for other methods           | Invalid request message               |
   | 403 Forbidden             | Access to resource denied             |
   | 404 Not Found             | Resource target or resource types.

             The default value is determined by the config-stmt
             value of the requested data nodes. If 'false', then
             the default is 'nonconfig'.  If 'true' then the
             default node not  |
   |                           | found                                 |
   | 405 Method Not Allowed    | Method not allowed for target         |
   |                           | resource                              |
   | 409 Conflict              | Resource or lock in use               |
   | 412 Precondition Failed   | Conditional method is 'config'.";
       }

       leaf depth {
         type union {
           type enumeration {
             enum unbounded {
               description "All sub-resources will be returned.";
             }

           } false           |
   | 413 Request Entity Too    | too-big error                         |
   | Large                     |                                       |
   | 414 Request-URI Too Large | too-big error                         |
   | 415 Unsupported Media     | non RESTCONF media type uint32 {
             range "1..max";
           }
         }
         default unbounded;
         description
           "The 'depth' parameter is               |
   | Type                      |                                       |
   | 500 Internal Server Error | operation-failed                      |
   | 501 Not Implemented       | unknown-operation                     |
   | 503 Service Unavailable   | Recoverable server error              |
   +---------------------------+---------------------------------------+

                    HTTP Status Codes used to specify the number
            of nest levels returned in RESTCONF

   Since an operation resource is defined with a response for YANG "rpc" statement, a GET method.
            The first nest-level consists of
   mapping between the requested data node
            itself. Any child nodes which are contained within
            a parent node have a depth NETCONF <error-tag> value that is 1 greater than
            its parent.

            This parameter is only allowed for GET methods on api,
            datastore, and data resources.  A 400 Bad Request error the HTTP status
   code is returned if used for other methods or resource types.

            By default, needed.  The specific error condition and response code to
   use are data-model specific and might be contained in the server will include all sub-resources
            within a retrieved resource, which have YANG
   "description" statement for 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.";
       }

       leaf filter {
         type yang:xpath1.0;
         description
           "The 'filter' parameter is used "rpc" statement.

                 +-------------------------+-------------+
                 | <error-tag>             | status code |
                 +-------------------------+-------------+
                 | in-use                  | 409         |
                 | invalid-value           | 400         |
                 | too-big                 | 413         |
                 | missing-attribute       | 400         |
                 | bad-attribute           | 400         |
                 | unknown-attribute       | 400         |
                 | bad-element             | 400         |
                 | unknown-element         | 400         |
                 | unknown-namespace       | 400         |
                 | access-denied           | 403         |
                 | lock-denied             | 409         |
                 | resource-denied         | 409         |
                 | rollback-failed         | 500         |
                 | data-exists             | 409         |
                 | data-missing            | 409         |
                 | operation-not-supported | 501         |
                 | operation-failed        | 500         |
                 | partial-operation       | 500         |
                 | malformed-message       | 400         |
                 +-------------------------+-------------+

                   Mapping from error-tag to indicate which subset of
            all possible events are of interest.  If not present, all
            events not precluded by other parameters will be sent.

            This parameter is only allowed status code

6.1.  Error Response Message

   When an error occurs for GET methods a request message on a
            text/event-stream data resource.  A 400 Bad Request error
            is returned if used for other methods or resource types.

            The format of this parameter is or an XPath expression,
   operation resource, and
            is evaluated in the following context:

            o  The set of namespace declarations is the set a "4xx" class of
               prefix and namespace pairs status codes (except for all supported YANG
               modules, where
   status code "403 Forbidden"), then the prefix is server SHOULD send a response
   body containing the YANG module name, and
               the namespace is as defined information described by the 'namespace' statement
               in "errors" container
   definition within the YANG module.
            o  The function library is the core function library defined
               in XPATH.

            o module Section 7.  The set Content-Type of variable bindings is empty.

            o  The context node is the root node
   this response message MUST be application/yang.errors.

   YANG Tree Diagram for <errors> Data:

      +--ro errors
         +--ro error
            +--ro error-type       enumeration
            +--ro error-tag        string
            +--ro error-app-tag?   string
            +--ro (error-node)?
            |  +--:(error-path)
            |  |  +--ro error-path?      instance-identifier
            |  +--:(error-urlpath)
            |     +--ro error-urlpath?   data-resource-identifier
            +--ro error-message?   string
            +--ro error-info

   The filter is used as semantics and syntax for RESTCONF error messages are defined in [RFC5277], section 3.6.
           If the boolean result of the expression is true when applied
           to the conceptual 'notification' document root, then the
           notification event is delivered to
   the client.";
       }

       leaf insert "errors" YANG grouping in Section 7.

   Examples:

   The following example shows an error returned for an "lock-denied"
   error on a datastore resource.

      POST /restconf/operations/example-ops:lock-datastore HTTP/1.1
      Host: example.com

   The server might respond:

      HTTP/1.1 409 Conflict
      Date: Mon, 23 Apr 2012 17:11:00 GMT
      Server: example-server
      Content-Type: application/yang.errors+json

      {
         type enumeration
        "ietf-restconf:errors": {
           enum first
          "error": {
             description "Insert the new data as the new first entry.";
            "error-type": "protocol",
            "error-tag": "lock-denied",
            "error-message": "Lock failed, lock already held"
          }
           enum last {
             description "Insert the new data as the new last entry.";
        }
           enum before {
             description
               "Insert the new data before the insertion point,
                specified by the value of the 'point' parameter.";
      }
           enum after {
             description
               "Insert the new

   The following example shows an error returned for a "data-exists"
   error on a data after the insertion point,
                specified by the value of the 'point' parameter."; resource.  The "jukebox" resource already exists so
   it cannot be created.

   The client might send:

      POST /restconf/data/example-jukebox:jukebox HTTP/1.1
      Host: example.com

   The server might respond:

      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": "data-exists",
            "error-urlpath": "http://example.com/restconf/data/
                 example-jukebox:jukebox",
            "error-message":
              "Data already exists, cannot create new resource"
          }
        }
         default last;
         description
           "The 'insert' parameter is used
      }

7.  RESTCONF module

   The "ietf-restconf" module defines conceptual definitions within
   groupings, which are not meant to specify how a
            resource should be inserted within implemented as datastore
   contents by a user-ordered list.

            This parameter is only supported for the POST and PUT
            methods. It is also only supported if the target
            resource server.  The "restconf" container is not intended to be
   implemented as a top-level data resource, and that data represents
            a YANG list or leaf-list that node (under the "/restconf/data"
   entry point).

   The "ietf-yang-types" module from [RFC6991] is ordered used by this module
   for some type definitions.

   RFC Ed.: update the user.

            If date below with the values 'before' or 'after' are used,
            then a 'point' query parameter date of RFC publication and
   remove this note.

   <CODE BEGINS> file "ietf-restconf@2014-10-07.yang"

   module ietf-restconf {
     namespace "urn:ietf:params:xml:ns:yang:ietf-restconf";
     prefix "rc";

     import ietf-yang-types { prefix yang; }

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

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

        WG Chair: Bert Wijnen
                  <mailto:bertietf@bwijnen.net>

        WG Chair: Mehmet Ersue
                  <mailto:mehmet.ersue@nsn.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 the insertion
            parameter MUST also be present, or a 400 Bad Request message and error is returned.";
       }

       leaf point {
         type data-resource-identifier;
         description
           "The 'point' parameter content that 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.

            This parameter is only supported for in
        RESTCONF protocol messages. A conceptual container
        representing the POST and PUT
            methods. It RESTCONF API nodes is also only supported if defined
        for the target
            resource is a data resource, and that data represents
            a YANG list or leaf-list media type application/yang.api.

        Note that is ordered by the user.

            If the 'insert' query parameter is YANG definitions within this module do not present, or has
            a value other than 'before' or 'after', then a 400
            Bad Request error is returned.

            This parameter contains the instance identifier
        represent configuration data of any kind.
        The YANG grouping statements provide a normative syntax
        for XML and JSON message encoding purposes.

        Copyright (c) 2014 IETF Trust and the
            resource to be used persons identified as
        authors of the insertion point for a
            POST code.  All rights reserved.

        Redistribution and use in source and binary forms, with or PUT method.";
       }

       leaf select {
         type string {
           length "1 .. max";
         }
         description
           "The 'select' query parameter
        without modification, is used permitted pursuant to, and subject
        to optionally identify
            data nodes within the target resource to be retrieved license terms contained in, the Simplified BSD License
        set forth in a
            GET method.  The client can use this parameter Section 4.c of the IETF Trust's Legal Provisions
        Relating to retrieve
            a subset IETF Documents
        (http://trustee.ietf.org/license-info).

        This version of all nodes in a resource.

            A value this YANG module is part of RFC XXXX; see
        the 'select' query parameter matches 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-02.txt

     // RFC Ed.: update the
            following rule:

              select-expr = path '(' select-expr / '*' ')' /
                            path ';' select-expr /
                            path
              path = api-identifier [ '/' path ]

            'api-identifier' is defined in section 5.3.1.1.

            ';' is used to select multiple nodes.  For example, to
            retreive only date below with the 'genre' and 'year' of an album, use:
            'select=genre;year'.

            Parentheses are used to specify sub-selectors date of RFC publication
     // and remove this note.
     revision 2014-10-07 {
       description
         "Initial revision.";
       reference
         "RFC XXXX: RESTCONF Protocol.";
     }

     typedef data-resource-identifier {
       type string {
         length "1 .. max";
       }
       description
         "Contains a node.
            For example, Data Resource Identifier formatted string
          to retreive only the 'label' and
            'catalogue-number' of an album, use:
            'select=admin(label;catalogue-number)'.

            '/' identify a specific data resource instance.
          The document root for all data resources is used in a path to retreive
          datastore resource container. Each top-level YANG
          data nodes supported by the server will be represented
          as a child node of a node.
            For example, to retreive only the 'label' document root.

          The canonical representation of an album, use:
            'select=admin/label'.

            This parameter is only allowed for GET methods on api,
            datastore, and a data resources.  A 400 Bad Request error resource identifier
          includes the full server specification that is returned if used for other methods or
          in the Location header when a new data resource types.";
       reference
         "RFC XXXX: [sec. 5.3.1.1 ABNF For Data Resource Identifiers]";
       }

       leaf start-time {
         type yang:date-and-time;
         description
           "The 'start-time' parameter is used to trigger
            the notification replay feature and indicate
            that created
          with the replay should start at the time specified.
            If the stream POST method.

          The abbreviated representation does not support replay, per the
            'replay-support' attribute returned by
            the /restconf/streams resource, then the contain any server MUST
            return the HTTP error code 400 Bad Request.

            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.

            If this parameter is not present, then a replay subscription
            is not begin 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,
          location identification. Instead the replay identifier will begin with the earliest available notification";
       }

       leaf stop-time {
         type yang:date-and-time;
         description
           "The 'stop-time' parameter is used start
          with the
            replay feature '/' character to indicate the newest notifications of
            interest.  This parameter MUST be used with and have a
            value later than represent the 'start-time' parameter.

            This parameter is only allowed datastore document
          root for GET methods on a
            text/event-stream the data resource.  A 400 Bad Request error
            is returned if used for other methods or resource types.

            If this parameter is not present, the notifications will
            continue until instance.

          The server MUST accept either representation and SHOULD
          return the subscription is terminated.
            Values canonical representation in the future are valid.";
       } any response message.";
       reference
         "RFC XXXX: [sec. 5.3.1.1 ABNF For Data Resource Identifiers]";
     }  //

     grouping query-parameters
     grouping notification errors {
       description
         "Contains
         "A grouping that contains a YANG container
          representing the notification message wrapper definition."; syntax and semantics of a
          YANG Patch errors report within a response message.";

       container notification errors {
         description
           "RESTCONF notification message wrapper.";
           "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 event-time error-type {
             type yang:date-and-time;
           mandatory true; enumeration {
               enum transport {
                 description "The time the event was generated by the
              event source.";
           reference
             "RFC 5277, section 4, <eventTime> element."; transport layer";
               }

         /* The YANG-specific notification container is encoded
          * after the 'event-time' element.  The format
          * corresponds to the notificationContent element
          * in RFC 5277, section 4. For example:
          *
          *  module example-one
               enum rpc {
          *     ...
          *
                 description "The rpc or notification event1 layer";
               }
               enum protocol { ...
                 description "The protocol operation layer";
               }
          *
          *
               enum application {
                 description "The server application layer";
               }
          *
          *  Encoded as element 'event1' in
             }
             mandatory true;
             description
               "The protocol layer where the namespace
          *  for module 'example-one'.
          */ error occurred.";
           }

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

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

   <CODE ENDS>

8.  IANA Considerations

8.1.  The "restconf" Relation Type

   This specification registers

           choice error-node {
             description
               "The server will return the "restconf" relation type in location of the Link
   Relation Type Registry defined by [RFC5988]:

      Relation Name:  restconf

      Description:  Identifies error node
                in a format that is appropriate for the root of RESTCONF API as configured
                    on this HTTP server.  The "restconf" relation
                    defines protocol.

                If no specific node within the root of request message body
                caused the API defined in RFCXXXX.
                    Subsequent revisions of RESTCONF error then this choice will use alternate
                    relation values to support protocol versioning.

      Reference:  RFC XXXX

   `

8.2. not be present.";

             leaf error-path {
               type instance-identifier;
               description
                 "The YANG Module Registry

   This document registers one URI in the IETF XML registry [RFC3688].
   Following the format in RFC 3688, instance identifier associated
                  with the following registration is
   requested to error node. This leaf will only be made.

        URI: urn:ietf:params:xml:ns:yang:ietf-restconf
        Registrant Contact: The NETMOD WG of
                  present if the IETF.
        XML: N/A, error node is not a data resource,
                  e.g., the requested URI error node is an XML namespace. input parameter
                  for an operation resource.";
             }
             leaf error-urlpath {
               type data-resource-identifier;
               description
                 "The target data resource identifier associated
                  with the error node.  This document registers one YANG module in leaf will only be
                  present if the YANG Module Names
   registry [RFC6020].

     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

8.3.  application/yang Media Sub Types

   The parent MIME media type for RESTCONF resources is application/
   yang, which error node is defined associated with
                  a data resource (either within the server or
                  in [RFC6020].  This document defines the
   following sub-types request message).";
             }
           }

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

           anyxml error-info {
              description
                "Arbitrary XML that represents a container
                 of additional information for this media type.

      - api
      - data
      - datastore
      - the error report.";
           }
         }
       }
     } // grouping errors
      - operation
      - stream

      Type name: application

      Subtype name: yang.xxx

      Required parameters: TBD

      Optional parameters: TBD

      Encoding considerations: TBD

      Security considerations: TBD

      Interoperability considerations: TBD

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

9.  Security Considerations

   This section provides security considerations for

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

         container data {
           description
             "Container representing the RESTCONF protocol.  Security considerations for HTTPS
   are defined in [RFC2818].  Security considerations for application/yang.datastore
              resource type. Represents the content
   manipulated conceptual root of all
              operational data and configuration data supported by RESTCONF can be found in
              the documents defining data
   models.

   This document does not specify an authentication scheme, but it does
   require that an authenticated NETCONF username be associated with
   each HTTP request. server.  The authentication scheme MAY child nodes of this container can be implemented in
              any data resource (application/yang.data), which are
              defined as top-level data nodes from the underlying transport layer (e.g., client certificates) or within YANG modules
              advertised by the HTTP layer (e.g., Basic Auth, OAuth, etc.).  RESTCONF does not
   itself define an authentication mechanism, authentication MUST occur server 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.

   Authorization of individual user access to ietf-restconf-monitoring
              module.";
         }

         container operations and data MAY be
   configured via NETCONF Access Control Model (NACM) [RFC6536], {
           description
             "Container for all operation resources
              (application/yang.operation),

              Each resource is represented as
   specified in Section 2.  Other authorization models MAY be used, but
   are outside of an empty leaf with the scope
              name of this document.

   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.

   Different environments may well allow different rights prior to and
   then after authentication.  When an RPC operation is not properly
   authorized, from the RESTCONF server MUST return HTTP error status code
   401 Unauthorized.  Note that authorization information can be
   exchanged in YANG rpc statement.

              E.g.;

                 POST /restconf/operations/show-log-errors

                 leaf show-log-errors {
                   type empty;
                 }
             ";
         }
       } // container restconf
     } // grouping restconf

     grouping notification {
       description
         "Contains the form of configuration information, which notification message wrapper definition.";

       container notification {
         description
           "RESTCONF notification message wrapper.";

         leaf event-time {
           type yang:date-and-time;
           mandatory true;
           description
             "The time the event was generated by the
              event source.";
           reference
             "RFC 5277, section 4, <eventTime> element.";
         }
         /* The YANG-specific notification container is all encoded
          * after the
   more reason 'event-time' element.  The format
          * corresponds to ensure the security of the connection.

10.  References

10.1.  Normative References

   [I-D.lhotka-netmod-json]
              Lhotka, L., "Modeling JSON Text with YANG",
              draft-lhotka-netmod-yang-json-02 (work in progress),
              September 2013.

   [JSON]     Bray, T., Ed., "The JSON Data Interchange Format",
              draft-ietf-json-rfc4627bis-10 (work in progress),
              December 2013.

   [RFC2119]  Bradner, S., "Key words for use notificationContent element
          * in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

   [RFC2246]  Dierks, T. and C. 5277, section 4. For example:
          *
          *  module example-one {
          *     ...
          *     notification event1 { ... }
          *
          *  }
          *
          *  Encoded as element 'event1' in the namespace
          *  for module 'example-one'.
          */
       }
     }  // grouping notification

   }

   <CODE ENDS>

8.  RESTCONF Monitoring

   The "ietf-restconf-monitoring" module provides information about the
   RESTCONF protocol capabilities and notification event streams
   available from the server.  Implementation is mandatory for RESTCONF
   servers, if any protocol capabilities or notification event streams
   are supported.

   YANG Tree Diagram for "ietf-restconf-monitoring" module:

      +--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 events                      inet:uri

8.1.  restconf-state/capabilities

   This mandatory container holds the RESTCONF protocol capability URIs
   supported by the server.

   The server MUST maintain a last-modified timestamp for this
   container, and return the "Last-Modified" header when this data node
   is retrieved with the GET or HEAD methods.

   The server SHOULD maintain an entity-tag for this container, and
   return the "ETag" header when this data node is retrieved with the
   GET or HEAD methods.

8.2.  restconf-state/streams

   This optional container provides access to the notification event
   streams supported by the server.  The server MAY omit this container
   if no notification event streams are supported.

   The server will populate this container with a stream list entry for
   each stream type it supports.  Each stream contains a leaf called
   "events" which contains a URI that represents an event stream
   resource.

   Stream resources are defined in Section 2.8.  Notifications are
   defined in Section 5.

8.3.  RESTCONF Monitoring Module

   The "ietf-restconf-monitoring" module defines monitoring information
   for the RESTCONF protocol.

   The "ietf-yang-types" and "ietf-inet-types" modules from [RFC6991]
   are used by this module for some type definitions.

   RFC Ed.: update the date below with the date of RFC publication and
   remove this note.

   <CODE BEGINS> file "ietf-restconf-monitoring@2014-10-07.yang"

   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: Bert Wijnen
                  <mailto:bertietf@bwijnen.net>

        WG Chair: Mehmet Ersue
                  <mailto:mehmet.ersue@nsn.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) 2014 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-02.txt

     // RFC Ed.: update the date below with the date of RFC publication
     // and remove this note.
     revision 2014-10-07 {
       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";
             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.";
           }

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

   }

   <CODE ENDS>

9.  YANG Module Library

   The "ietf-yang-library" module 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.

   YANG Tree Diagram for "ietf-yang-library" module:

     +--ro modules
         +--ro module-set-id?   string
         +--ro module* [name revision]
            +--ro name           yang:yang-identifier
            +--ro revision       union
            +--ro schema?        inet:uri
            +--ro namespace      inet:uri
            +--ro feature*       yang:yang-identifier
            +--ro deviation*     yang:yang-identifier
            +--ro conformance    boolean
            +--ro submodules
               +--ro submodule* [name revision]
                  +--ro name        yang:yang-identifier
                  +--ro revision    union
                  +--ro schema?     inet:uri

9.1.  modules

   This mandatory container holds the identifiers for the YANG data
   model modules supported by the server.

   The server MUST maintain a last-modified timestamp for this
   container, and return the "Last-Modified" header when this data node
   is retrieved with the GET or HEAD methods.

   The server SHOULD maintain an entity-tag for this container, and
   return the "ETag" header when this data node is retrieved with the
   GET or HEAD methods.

9.1.1.  modules/module

   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.

   The contents of the "module" list are defined in the "module" YANG
   list statement in Section 9.2.

   The server MAY maintain a last-modified timestamp for each instance
   of this list entry, and return the "Last-Modified" header when this
   data node is retrieved with the GET or HEAD methods.  If not
   supported then the timestamp for the parent "modules" container MAY
   be used instead.

   The server MAY maintain an entity-tag for each instance of this list
   entry, and return the "ETag" header when this data node is retrieved
   with the GET or HEAD methods.  If not supported then the timestamp
   for the parent "modules" container MAY be used instead.

9.2.  YANG Library Module

   The "ietf-yang-library" module defines monitoring information for the
   YANG modules used by a RESTCONF server.

   The "ietf-yang-types" and "ietf-inet-types" modules from [RFC6991]
   are used by this module for some type definitions.

   RFC Ed.: update the date below with the date of RFC publication and
   remove this note.

   <CODE BEGINS> file "ietf-yang-library@2014-10-07.yang"

   module ietf-yang-library {
     namespace "urn:ietf:params:xml:ns:yang:ietf-yang-library";
     prefix "yanglib";

     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: Bert Wijnen
                  <mailto:bertietf@bwijnen.net>

        WG Chair: Mehmet Ersue
                  <mailto:mehmet.ersue@nsn.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 about the YANG
        modules and submodules that are used within a RESTCONF
        server.

        Copyright (c) 2014 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-02.txt

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

     typedef revision-identifier {
       type string {
         pattern '\d{4}-\d{2}-\d{2}';
       }
       description
         "Represents a specific date in YYYY-MM-DD format.
          TBD: make pattern more precise to exclude leading zeros.";
     }

     grouping module {
       description
         "The module data structure is represented as a grouping
          so it can be reused in configuration or another monitoring
          data structure.";

       grouping common-leafs {
         description
           "Common parameters for YANG modules and submodules.";

         leaf name {
           type yang:yang-identifier;
           description "The YANG module or submodule name.";
         }
         leaf revision {
           type union {
             type revision-identifier;
             type string { length 0; }
           }
           description
             "The YANG module or submodule revision date.
              An empty string is used if no revision statement
              is present in the YANG module or submodule.";
         }
         leaf schema {
           type inet:uri;
           description
             "Contains a URL that represents the YANG schema
              resource for this module or submodule.

              This leaf will only be present if there is a URL
              available for retrieval of the schema for this entry.";
         }
       }

       list module {
         key "name revision";
         description
           "Each entry represents one module currently
            supported by the server.";

         uses common-leafs;

         leaf namespace {
           type inet:uri;
           mandatory true;
           description
             "The XML namespace identifier for this module.";
         }
         leaf-list feature {
           type yang:yang-identifier;
           description
             "List of YANG feature names from this module that are
              supported by the server.";
         }
         leaf-list deviation {
           type yang:yang-identifier;
           description
             "List of YANG deviation module names used by this
              server to modify the conformance of the module
              associated with this entry.";
         }
         leaf conformance {
           type boolean;
           mandatory true;
           description
             "If 'true', then the server is claiming conformance to
              the YANG module identified in this entry.

              If 'false', then the server is not claiming any
              conformance for the YANG module identified by this
              entry. The module may be needed for reusable definitions
              such as extensions, features, identifies, typedefs,
              or groupings.";
         }
         container submodules {
           description
             "Contains information about all the submodules used
              by the parent module entry";

           list submodule {
             key "name revision";
             description
               "Each entry represents one submodule within the
                parent module.";
             uses common-leafs;
           }
         }
       } // list module
     }  // grouping module

     container modules {
       config false;
       description
         "Contains YANG module monitoring information.";

       leaf module-set-id {
         type string;
         description
           "Contains a server-specific identifier representing
            the current set of modules and submodules.  The
            server MUST change the value of this leaf if the
            information represented by the 'module' list instances
            has changed.";
       }

       uses module;

     }

   }

   <CODE ENDS>

10.  IANA Considerations

10.1.  The "restconf" Relation Type

   This specification registers the "restconf" relation type in the Link
   Relation Type Registry defined by [RFC5988]:

      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

   `

10.2.  YANG Module Registry

   This document registers three URIs in the IETF XML registry
   [RFC3688].  Following the format in RFC 3688, the following
   registration is requested to be made.

        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.

        URI: urn:ietf:params:xml:ns:yang:ietf-yang-library
        Registrant Contact: The NETMOD WG of the IETF.
        XML: N/A, the requested URI is an XML namespace.

   This document registers three YANG modules in the YANG Module Names
   registry [RFC6020].

     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

     name:         ietf-yang-library
     namespace:    urn:ietf:params:xml:ns:yang:ietf-yang-library
     prefix:       yanglib
     // RFC Ed.: replace XXXX with RFC number and remove this note
     reference:    RFC XXXX

10.3.  application/yang Media Sub Types

   The parent MIME media type for RESTCONF resources is application/
   yang, which is defined in [RFC6020].  This document defines the
   following sub-types for this media type.

      - api
      - data
      - datastore
      - errors
      - operation
      - stream

      Type name: application

      Subtype name: yang.xxx

      Required parameters: TBD

      Optional parameters: TBD

      Encoding considerations: TBD

      Security considerations: TBD

      Interoperability considerations: TBD

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

10.4.  NETCONF Capability URNs

   This document registers several capability identifiers in "Network
   Configuration Protocol (NETCONF) Capability URNs" registry

     Index
        Capability Identifier
     ------------------------

     :content
         urn:ietf:params:restconf:capability:content:1.0

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

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

     :insert
         urn:ietf:params:restconf:capability:insert:1.0

     :select
         urn:ietf:params:restconf:capability:select:1.0

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

11.  Security Considerations

   This section provides security considerations for the resources
   defined by the RESTCONF protocol.  Security considerations for HTTPS
   are defined in [RFC2818].  Security considerations for the content
   manipulated by RESTCONF can be found in the documents defining data
   models.

   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.

   Authorization of individual user access to operations and data MAY be
   configured via NETCONF Access Control Model (NACM) [RFC6536], as
   specified in Section 3.  Other authorization models MAY be used, but
   are outside of the scope of this document.

   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.

   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.

12.  Acknowledgements

   The authors would like to thank for following for lively discussions
   on list and in the halls (ordered by last name): Rex Fernando

13.  References

13.1.  Normative References

   [I-D.lhotka-netmod-json]
              Lhotka, L., "Modeling JSON Text with YANG", draft-lhotka-
              netmod-yang-json-02 (work in progress), September 2013.

   [JSON]     Bray, T., Ed., "The JSON Data Interchange Format", draft-
              ietf-json-rfc4627bis-10 (work in progress), December 2013.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

   [RFC2246]  Dierks, T. and C. Allen, "The TLS Protocol, Version 1.0",
              RFC 2246, January 1999.

   [RFC2396]  Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
              Resource Identifiers (URI): Generic Syntax", RFC 2396,
              August 1998.

   [RFC2616]  Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
              Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
              Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.

   [RFC2818]  Rescorla, E., "The IETF XML Registry", RFC 2818, May 2000.

   [RFC3688]  Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688,
              January 2004.

   [RFC3986]  Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
              Resource Identifier (URI): Generic Syntax", STD 66, RFC
              3986, January 2005.

   [RFC5277]  Chisholm, S. and H. Trevino, "NETCONF Event
              Notifications", RFC 5277, July 2008.

   [RFC5280]  Cooper, D., Santesson, S., Farrell, S., Boeyen, S.,
              Housley, R., and T. Polk, "Internet X.509 Public Key
              Infrastructure Certificate and Certificate Revocation List
              (CRL) Profile", RFC 5280, May 2008.

   [RFC5789]  Dusseault, L. and J. Snell, "PATCH Method for HTTP",
              RFC 5789, March 2010.

   [RFC5988]  Nottingham, M., "Web Linking", RFC 5988, October 2010.

   [RFC6020]  Bjorklund, M., "YANG - A Data Modeling Language for the
              Network Configuration Protocol (NETCONF)", RFC 6020,
              October 2010.

   [RFC6241]  Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed.,
              and A. Bierman, Ed., "Network Configuration Protocol
              (NETCONF)", RFC 6241, June 2011.

   [RFC6415]  Hammer-Lahav, E. and B. Cook, "Web Host Metadata",
              RFC 6415, October 2011.

   [RFC6536]  Bierman, A. and M. Bjorklund, "Network Configuration
              Protocol (NETCONF) Access Control Model", RFC 6536,
              March 2012.

   [RFC6570]  Gregorio, J., Fielding, R., Hadley, M., Nottingham, M.,
              and D. Orchard, "URI Template", RFC 6570, March 2012.

   [RFC6991]  Schoenwaelder, J., "Common YANG Data Types", RFC 6991,
              July 2013.

   [W3C.REC-xml-20081126]
              Yergeau, F., Maler, E., Paoli, J., Sperberg-McQueen, C.,
              and T. Bray, "Extensible Markup Language (XML) 1.0 (Fifth
              Edition)", World Wide Web Consortium Recommendation REC-
              xml-20081126, November 2008,
              <http://www.w3.org/TR/2008/REC-xml-20081126>.

   [get-off-my-lawn]
              Nottingham, M., "URI Design and Ownership", Best Current
              Practice draft-ietf-appsawg-uri-get-off-my-lawn-05,
              May 2014.

   [rest-dissertation]
              Fielding, R., "Architectural Styles and the Design of
              Network-based Software Architectures", 2000.

   [wd-eventsource]
              Hickson, I., "Server-Sent Events", December 2012.

10.2.  Informative References

   [XPath]    Clark, J. and S. DeRose, "XML Path Language (XPath)
              Version 1.0", World Wide Web Consortium
              Recommendation REC-xpath-19991116, November 1999,
              <http://www.w3.org/TR/1999/REC-xpath-19991116>.

Appendix A.  Change Log

       -- for HTTP", RFC Ed.: remove this section before publication.

A.1.  00
              5789, March 2010.

   [RFC5988]  Nottingham, M., "Web Linking", RFC 5988, October 2010.

   [RFC6020]  Bjorklund, M., "YANG - 01

   o  fixed content=nonconfig example (non-config was incorrect)

   o  closed open issue 'message-id'.  There is no need A Data Modeling Language for a message-id
      field, the
              Network Configuration Protocol (NETCONF)", RFC 6020,
              October 2010.

   [RFC6241]  Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed.,
              and A. Bierman, Ed., "Network Configuration Protocol
              (NETCONF)", RFC 2392 does not apply.

   o  closed open issue 'server support verification'.  The headers used
      by RESTCONF are widely supported.

   o  removed encoding rules from section on RESTCONF Meta-Data.  This
      is now defined in [I-D.lhotka-netmod-json].

   o  added media type application/yang.errors to map to errors YANG
      grouping.  Updated error examples to use new media type.

   o  closed open issue 'additional datastores'.  Support may be added
      in the future to identify new datastores.

   o  closed open issue 'PATCH media type discovery'.  The section on
      PATCH has an added sentence on the Accept-Patch header.

   o  closed open issue 'YANG to resource mapping'.  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.

   o  closed open issue '_self links for HATEOAS support'.  It was
      decided that they are redundant because they can be derived from
      the 6241, June 2011.

   [RFC6415]  Hammer-Lahav, E. and B. Cook, "Web Host Metadata", RFC
              6415, October 2011.

   [RFC6536]  Bierman, A. and M. Bjorklund, "Network Configuration
              Protocol (NETCONF) Access Control Model", RFC 6536, March
              2012.

   [RFC6570]  Gregorio, J., Fielding, R., Hadley, M., Nottingham, M.,
              and D. Orchard, "URI Template", RFC 6570, March 2012.

   [RFC6991]  Schoenwaelder, J., "Common YANG module for the specific data.

   o  added explanatory text for the 'select' parameter.

   o  added RESTCONF Path Resolution section for discovering Data Types", RFC 6991,
              July 2013.

   [W3C.REC-xml-20081126]
              Yergeau, F., Maler, E., Paoli, J., Sperberg-McQueen, C.,
              and T. Bray, "Extensible Markup Language (XML) 1.0 (Fifth
              Edition)", World Wide Web Consortium Recommendation REC-
              xml-20081126, November 2008,
              <http://www.w3.org/TR/2008/REC-xml-20081126>.

   [get-off-my-lawn]
              Nottingham, M., "URI Design and Ownership", Best Current
              Practice draft-ietf-appsawg-uri-get-off-my-lawn-05, May
              2014.

   [rest-dissertation]
              Fielding, R., "Architectural Styles and the root Design of
      the RESTCONF API using the /.well-known/host-meta.

   o  added an "error" media type to for structured error messages

   o  added Secure Transport section requiring TLS

   o  added Security Considerations section

   o  removed all references to "REST-like"

A.2.  bierman:restconf-04 to ietf:restconf-00

   o  updated open issues section
              Network-based Software Architectures", 2000.

   [wd-eventsource]
              Hickson, I., "Server-Sent Events", December 2012.

13.2.  Informative References

   [XPath]    Clark, J. and S. DeRose, "XML Path Language (XPath)
              Version 1.0", World Wide Web Consortium Recommendation
              REC-xpath-19991116, November 1999,
              <http://www.w3.org/TR/1999/REC-xpath-19991116>.

Appendix B.  Open Issues A.  Change Log

       -- RFC Ed.: remove this section before publication.

B.1.  select parameter

A.1.  01 - 02

   o  What syntax should be used for the "select"  moved query parameter?  The
      current choices are "XPath" and "path-expr".  Perhaps an
      additional parameter to identify definitions from the select string format is
      needed YANG module back to allow extensibility?

   Status: solution proposal added by Martin.

B.2.  netconf-state monitoring support the
      plain text sections

   o  Should long-term RESTCONF operations (i.e.  SSE long-poll) be
      considered sessions with regards  made all query parameters optional to NETCONF monitoring "session"
      list?  If so, what text is needed in RESTCONF draft implement

   o  defined query parameter capability URI

   o  moved 'streams' to standardize
      the RESTCONF session entries?

   Status: closed-update-pending

   Resolution:

   A new data structure to monitor streams can be YANG module (ietf-restconf-monitoring)

   o  added 'capabilities' container to the netconf-
   state sub-tree.  The session-id in this new data structure is not
   restricted YANG module (ietf-restconf-
      monitoring)

   o  moved 'modules' container to the NETCONF-only rules for the sessions sub-tree.

B.3.  secure transport new YANG module (ietf-yang-library)

   o  added new leaf 'module-set-id' (ietf-yang-library)
   o  added new leaf 'conformance' (ietf-yang-library)

   o  Details  changed 'schema' leaf to support secure operation over TLS are needed

   Status: closed type inet:uri that returns the location
      of the YANG schema (instead of returning the schema directly)

   o  Security considerations need  changed 'events' leaf to be written

   Status: closed type inet:uri that returns the location
      of the event stream resource (instead of returning events
      directly)

   o  Can call-home  changed examples for RESTCONF be supported

   Status: open

B.4.  Encoding of key leafs yang.api resource since the monitoring
      information is no longer in this resource URIs

   o  The use of a forward slash '/' as  closed issue #1 'select parameter' since no objections to the delimiter between key values
      proposed syntax

   o  closed "encoding of list keys" issue since no objection to new
      encoding of list keys in a target resource URI is not not desirable.  Only 1 segment per
      YANG data node layer should be used.

   Status: URI.

   o  moved open

   Proposals:

   Example: issues list foo, int8 keys X to the issue tracker on github

A.2.  00 - 01

   o  fixed content=nonconfig example (non-config was incorrect)

   o  closed open issue 'message-id'.  There is no need for a message-id
      field, and Y

   Old:

     /restconf/data/foo/19/22/foo-leaf

   New:

     /restconf/data/foo=19,22/foo-leaf

   Or:

     /restconf/data/foo/19,22/foo-leaf

B.5.  get-bulk query parameters RFC 2392 does not apply.

   o  New query parameters (e.g., offset, limit)  closed open issue 'server support verification'.  The headers used
      by RESTCONF are needed to retrieve
      a limited number of list instances.

   Status: solution proposal pending

   Resolution: widely supported.

   o  removed encoding rules from section on RESTCONF Meta-Data.  This bulk retrieval mechanism will be added.

B.6.  defaults handling
      is now defined in [I-D.lhotka-netmod-json].

   o  added media type application/yang.errors to map to errors YANG
      grouping.  Updated error examples to use new media type.

   o  The client does not really know what sort of defaults the server
      will return in GET replies.  Should the with-defaults query
      parameter  closed open issue 'additional datastores'.  Support may be added
      in the future to RESTCONF?  If so, should it be mandatory-to-
      implement?

   Status: open

B.7.  protocol capability URIs identify new datastores.

   o  closed open issue 'PATCH media type discovery'.  The client does not know what vendor extensions (if any) are
      implemented by the server.  Should section on
      PATCH has an added sentence on the server provide a read-only
      container Accept-Patch header.

   o  closed open issue 'YANG to resource mapping'.  Current mapping of capability URIs
      all data nodes to identify protocol extensions?  The
      NETMOD WG may also want resources will be used in order to extend allow
      mandatory DELETE support.  The PATCH operation is optional, as
      well as the protocol in YANG Patch media type.

   o  closed open issue '_self links for HATEOAS support'.  It was
      decided that they are redundant because they can be derived from
      the future
      without updating YANG module for the core RESTCONF RFC.

   Status: open

B.8.  target resource list keys required specific data.

   o  added explanatory text for GET the 'select' parameter.

   o  Should  added RESTCONF Path Resolution section for discovering the client be able to GET all or a subset root of all list
      instances by issuing a GET without any list keys for
      the target
      resource list?

     GET /restconf/data/interfaces/interface RESTCONF API using the /.well-known/host-meta.

   o  Should a "collection" resource be required in order  added an "error" media type to for such a
      request structured error messages

   o  added Secure Transport section requiring TLS

   o  added Security Considerations section

   o  removed all references to be considered valid by the server.

   Status: "REST-like"

A.3.  bierman:restconf-04 to ietf:restconf-00

   o  updated open issues section

Appendix B.  Open Issues

       -- RFC Ed.: remove this section before publication.

   The RESTCONF issues are tracked on github.com:

      https://github.com/netconf-wg/restconf/issues

Appendix C.  Example YANG Module

   The example YANG module used in this document represents a simple
   media jukebox interface.

   YANG Tree Diagram for "example-jukebox" Module
      +--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       instance-identifier
         +--rw player
            +--rw gap?   decimal64

     rpcs:

      +---x play
         +--ro input
            +--ro playlist       string
            +--ro song-number    uint32

C.1.  example-jukebox YANG Module

   module example-jukebox {

      namespace "http://example.com/ns/example-jukebox";
      prefix "jbox";
      import ietf-restconf { prefix rc; }

      organization "Example, Inc.";
      contact "support at example.com";
      description "Example Jukebox Data Model Module";
      revision "2014-07-03" {
        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 rc:data-resource-identifier;
              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";
          }
        }
      }
   }

Appendix D.  RESTCONF Message Examples

   The examples within this document use the normative YANG module
   defined in Section 7 and the non-normative example YANG module
   defined in Appendix C.1.

   This section shows some typical RESTCONF message exchanges.

D.1.  Resource Retrieval Examples

D.1.1.  Retrieve the Top-level API Resource

   The client may start by retrieving the top-level API resource, using
   the entry point URI "{+restconf}".

      GET /restconf   HTTP/1.1
      Host: example.com
      Accept: application/yang.api+json,
              application/yang.errors+json

   The server might respond as follows:

      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 ],
          "modules": {
            "module": [
              {
                "name" : "example-jukebox",
                "revision" : "2014-07-03",
                "namespace" : "http://example.com/ns/example-jukebox",
                "schema" : [ null ]
              }
            ]
          },
          "operations" : {
             "play" : [ null ]
          },
          "streams" : {
            "stream" : [
              {
                "name" : "NETCONF",
                "description" : "default NETCONF event stream",
                "replay-support" : true,
                "replay-log-creation-time:" : "2007-07-08T00:00:00Z",
                "events" : [ null ]
              }
            ]
          }
        }
      }

   To request that the response content to be encoded in XML, the
   "Accept" header can be used, as in this example request:

      GET /restconf HTTP/1.1
      Host: example.com
      Accept: application/yang.api+xml,
              application/yang.errors+xml

   The server will return the same response either way, which might be
   as follows :

      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
      <restconf xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
        <data/>
        <modules>
          <module>
            <name>example-jukebox</name>
            <revision>2014-07-03</revision>
            <namespace>
              http://example.com/ns/example-jukebox
            </namespace>
            <schema />
          </module>
        </modules>
        <operations>
          <play xmlns="http://example.com/ns/example-jukebox"/>
        </operations>
        <streams>
          <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>
            <events/>
          </stream>
        </streams>
      </restconf>

D.1.2.  Retrieve The Server Module Information

   In this example the client is retrieving the modules resource information from
   the server in JSON format:

      GET /restconf/modules /restconf/data/modules  HTTP/1.1
      Host: example.com
      Accept: application/yang.api+json, application/yang.data+json,
              application/yang.errors+json

   The server might respond as follows.

      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 application/yang.data+json

      {
        "ietf-restconf:modules":
        "ietf-yang-library:modules": {
          "module": [
            {
              "name" : "foo",
              "revision" : "2012-01-02",
              "schema" : [null], "http://example.com/mymodules/foo/2012-01-02",
              "namespace" : "http://example.com/ns/foo",
              "feature" : [ "feature1", "feature2" ] ],
              "conformance" : true
            },
            {
              "name" : "foo-types",
              "revision" : "2012-01-05",
              "schema" :
                "http://example.com/mymodules/foo-types/2012-01-05",
              "schema" : [null],
              "namespace" : "http://example.com/ns/foo-types" "http://example.com/ns/foo-types",
              "conformance" : false
            },
            {
              "name" : "bar",
              "revision" : "2012-11-05",
              "schema" : [null], "http://example.com/mymodules/bar/2012-11-05",
              "namespace" : "http://example.com/ns/bar",
              "feature" : [ "bar-ext" ],
              "conformance" : true,
              "submodule" : [
                {
                  "name" : "bar-submod1",
                  "revision" : "2012-11-05",
                  "schema" : [null]
                   "http://example.com/mymodules/bar-submod1/2012-11-05"
                },
                {
                  "name" : "bar-submod2",
                  "revision" : "2012-11-05",
                  "schema" : [null]
                   "http://example.com/mymodules/bar-submod2/2012-11-05"
                }
              ]
            }
          ]
        }
      }

D.1.3.  Retrieve The Server Capability Information

   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:

      GET /restconf/data/restconf-state/capabilities  HTTP/1.1
      Host: example.com
      Accept: application/yang.data+json,
              application/yang.errors+json

   The server might respond as follows.

      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+json

      {
        "ietf-restconf-monitoring:capabilities": {
          "capability": [
            "urn:ietf:params:restconf:capability:content:1.0",
            "urn:ietf:params:restconf:capability:depth:1.0",
            "urn:ietf:params:restconf:capability:filter:1.0",
            "urn:ietf:params:restconf:capability:insert:1.0",
            "urn:ietf:params:restconf:capability:point:1.0",
            "urn:ietf:params:restconf:capability:select:1.0",
            "urn:ietf:params:restconf:capability:start-time:1.0",
            "urn:ietf:params:restconf:capability:stop-time:1.0",
            "http://example.com/capabilities/myparam"
          ]
        }
      }

D.2.  Edit Resource Examples

D.2.1.  Create New Data Resources

   To create a new "artist" resource within the "library" resource, the
   client might send the following request.

      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"
        }
      }

   If the resource is created, the server might respond as follows.
   Note that the "Location" header line is wrapped for display purposes
   only:

      HTTP/1.1 201 Created
      Date: Mon, 23 Apr 2012 17:02:00 GMT
      Server: example-server
      Location: http://example.com/restconf/data/
           example-jukebox:jukebox/library/artist=Foo%20Fighters
      Last-Modified: Mon, 23 Apr 2012 17:02:00 GMT
      ETag: b3830f23a4c

   To create a new "album" resource for this artist within the "jukebox"
   resource, the client might send the following request.  Note that the
   request URI header line is wrapped for display purposes only:

      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
        }
      }

   If the resource is created, the server might respond as follows.
   Note that the "Location" header line is wrapped for display purposes
   only:

      HTTP/1.1 201 Created
      Date: Mon, 23 Apr 2012 17:03:00 GMT
      Server: example-server
      Location: http://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

D.2.2.  Detect Resource Entity Tag Change

   In this example, the server just supports the mandatory datastore
   last-changed timestamp.  The client has previously retrieved the
   "Last-Modified" header and has some value cached to provide in the
   following request to patch an "album" list entry with key value
   "Wasting Light".  Only the "year" field is being updated.

      PATCH /restconf/data/example-jukebox:jukebox/
        library/artist=Foo%20Fighters/album=Wasting%20Light/year
        HTTP/1.1
      Host: example.com
      Accept: application/yang.data+json,
              application/yang.errors+json
      If-Unmodified-Since: Mon, 23 Apr 2012 17:01:00 GMT
      Content-Type: application/yang.data+json

      { "example-jukebox:year" : "2011" }

   In this example the datastore resource has changed since the time
   specified in the "If-Unmodified-Since" header.  The server might
   respond:

      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

D.3.  Query String Parameter Examples

D.3.1.  "content" Parameter

   The "content" 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.

   In this example, a simple YANG list that has configuration and non-
   configuration child resources.

     container events
       list event {
         key name;
         leaf name { type string; }
         leaf description { type string; }
         leaf event-count {
           type uint32;
           config false;
         }
       }
     }

   Example 1: content=all

   To retrieve all the child resources, the "content" parameter is set
   to "all".  The client might send:

      GET /restconf/data/example-events:events?content=all
          HTTP/1.1
      Host: example.com
      Accept: application/yang.data+json,
              application/yang.errors+json

   The server might respond:

      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
            }
          ]
        }
      }

   Example 2: content=config

   To retrieve only the configuration child resources, the "content"
   parameter is set to "config" or omitted since this is the default
   value.  Note that the "ETag" and "Last-Modified" headers are only
   returned if the content parameter value is "config".

      GET /restconf/data/example-events:events?content=config
         HTTP/1.1
      Host: example.com
      Accept: application/yang.data+json,
              application/yang.errors+json

   The server might respond:

      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"
            }
          ]
        }
      }

   Example 3: content=nonconfig

   To retrieve only the non-configuration child resources, the "content"
   parameter is set to "nonconfig".  Note that configuration ancestors
   (if any) and list key leafs (if any) are also returned.  The client
   might send:

      GET /restconf/data/example-events:events?content=nonconfig
         HTTP/1.1
      Host: example.com
      Accept: application/yang.data+json,
              application/yang.errors+json

   The server might respond:

      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
            }
          ]
        }
      }

D.3.2.  "depth" Parameter

   The "depth" parameter is used to limit the number of levels of child
   resources that are returned by the server for a GET method request.

   This example shows how different values of the "depth" parameter
   would affect the reply content for retrieval of the top-level
   "jukebox" data resource.

   Example 1: depth=unbounded

   To retrieve all the child resources, the "depth" parameter is not
   present or set to the default value "unbounded".  Note that some
   strings are wrapped for display purposes only.

      GET /restconf/data/example-jukebox:jukebox?depth=unbounded
         HTTP/1.1
      Host: example.com
      Accept: application/yang.data+json,
              application/yang.errors+json

   The server might respond:

      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" : "http://example.com/restconf/data/
                        example-jukebox:jukebox/library/artist/
                        Foo%20Fighters/album/Wasting%20Light/
                        song/Rope"
                },
                {
                  "index" : 2,
                  "id" : "http://example.com/restconf/data/
                        example-jukebox:jukebox/library/artist/
                        Foo%20Fighters/album/Wasting%20Light/song/
                        Bridge%20Burning"
                }
              ]
            }
          ],
          "player" : {
            "gap" : 0.5
          }
        }
      }

   Example 2: depth=1

   To determine if 1 or more resource instances exist for a given target
   resource, the value "1" is used.

      GET /restconf/data/example-jukebox:jukebox?depth=1 HTTP/1.1
      Host: example.com
      Accept: application/yang.data+json,
              application/yang.errors+json

   The server might respond:

      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]
      }

   Example 3: depth=3

   To limit the depth level to the target resource plus 2 child resource
   layers the value "3" is used.

      GET /restconf/data/example-jukebox:jukebox?depth=3 /restconf/data/example-jukebox:jukebox?depth=3 HTTP/1.1
      Host: example.com
      Accept: application/yang.data+json,
              application/yang.errors+json

   The server might respond:

      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
          }
        }
      }

D.3.3.  "select" Parameter

   In this example the client is retrieving the API resource, but
   selecting only the "name" and "revision" nodes from each module, in
   JSON format:

      GET /restconf/data?select=modules/module(name;revision) HTTP/1.1
      Host: example.com
      Accept: application/yang.data+json,
              application/yang.errors+json

   The server might respond: respond as follows.

      HTTP/1.1 200 OK
      Date: Mon, 23 Apr 2012 17:11:30 17:01:00 GMT
      Server: example-server
      Cache-Control: no-cache
      Pragma: no-cache
      Content-Type: application/yang.data+json

      {
        "example-jukebox:jukebox" : {
          "library" :
        "ietf-yang-library:modules": {
            "artist" : [ null ]
          },
          "playlist" :
          "module": [
            {
              "name" : "Foo-One",
              "description" "example-jukebox",
              "revision" : "example playlist 1",
              "song" "2014-07-03"
            },
            {
              "name" : [ null ]
            }
          ],
          "player" "ietf-restconf-monitoring",
              "revision" : "2014-10-07"
            },
            {
            "gap"
              "name" : 0.5 "ietf-yang-library",
              "revision" : "2014-10-07"
            }
          ]
        }
      }

D.3.3.  "filter" Parameter

   The following URIs show some examples of notification filter
   specifications (lines wrapped for display purposes only):

      // filter = /event/eventClass='fault'
      GET /restconf/streams/stream=NETCONF/events?
         filter=%2Fevent%2FeventClass%3D'fault'

      // filter = /event/severityCode<=4
      GET /restconf/streams/stream=NETCONF/events?
         filter=%2Fevent%2FseverityCode%3C%3D4

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

      // filter = /*/reportingEntity/card!='Ethernet0'
      GET /restconf/streams/stream=NETCONF/events?
         filter=%2F*%2FreportingEntity%2Fcard%21%3D'Ethernet0'

      // filter = /*/email-addr[contains(.,'company.com')]
      GET /restconf/streams/stream=critical-syslog/events?
         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 /restconf/streams/stream=NETCONF/events?
        filter=(%2Fexample-mod%3Aevent1%2Fname%3D'joe'%20and
                %20%2Fexample-mod%3Aevent1%2Fstatus%3D'online')

D.3.4.  "insert" Parameter

   In this example, a new first entry in the "Foo-One" playlist is being
   created.

   Request from client:

      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"
         }
      }

   Response from server:

      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: http://example.com/restconf/data/
         example-jukebox:jukebox/playlist=Foo-One/song=1
      ETag: eeeada438af

D.3.5.  "point" Parameter

   Example:

   In this example, the client is inserting a new "song" resource within
   an "album" resource after another song.  The request URI is split for
   display purposes only.

   Request from client:

      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
        }
      }

   Response from server:

      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

D.3.6.  "select"  "filter" Parameter

   In this example

   The following URIs show some examples of notification filter
   specifications (lines wrapped for display purposes only):

      // filter = /event/eventClass='fault'
      GET /mystreams/stream=NETCONF/events?
         filter=%2Fevent%2FeventClass%3D'fault'

      // filter = /event/severityCode<=4
      GET /mystreams/stream=NETCONF/events?
         filter=%2Fevent%2FseverityCode%3C%3D4

      // filter = /linkUp|/linkDown
      GET /mystreams/stream=SNMP/events?
         filter=%2FlinkUp%7C%2FlinkDown

      // filter = /*/reportingEntity/card!='Ethernet0'
      GET /mystreams/stream=NETCONF/events?
         filter=%2F*%2FreportingEntity%2Fcard%21%3D'Ethernet0'

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

      // Note: the client module name is retrieving the API resource, but
   selecting only the "name" used as prefix.
      // filter = (/example-mod:event1/name='joe' and "revision" nodes from each module, in
   JSON format:
      //           /example-mod:event1/status='online')
      GET /restconf?select=modules/module(name;revision) HTTP/1.1
      Host: example.com
      Accept: application/yang.api+json,
              application/yang.errors+json

   The server might respond as follows.

      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": {
          "modules": {
            "module": [
              {
                "name" : "example-jukebox",
                "revision" : "2014-07-03"
              }
            ]
          }
        }
      } /mystreams/stream=NETCONF/events?
        filter=(%2Fexample-mod%3Aevent1%2Fname%3D'joe'%20and
                %20%2Fexample-mod%3Aevent1%2Fstatus%3D'online')

D.3.7.  "start-time" Parameter

   TBD

D.3.8.  "stop-time" Parameter

   TBD

Authors' Addresses

   Andy Bierman
   YumaWorks

   Email: andy@yumaworks.com

   Martin Bjorklund
   Tail-f Systems

   Email: mbj@tail-f.com
   Kent Watsen
   Juniper Networks

   Email: kwatsen@juniper.net

   Rex Fernando
   Cisco

   Email: rex@cisco.com