RESTCONF ProtocolYumaWorksandy@yumaworks.comTail-f Systemsmbj@tail-f.comJuniper Networkskwatsen@juniper.netCiscorex@cisco.com
This document describes a RESTful protocol that provides
a programmatic interface over HTTP for accessing data
defined in YANG, using the datastores defined in NETCONF.
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 a RESTful protocol called RESTCONF,
running over HTTP , for accessing data defined
in YANG , using datastores defined in NETCONF .
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. RESTful operations are used to
access the hierarchical data within a datastore.
A RESTful API can be created that provides CRUD operations on a
NETCONF datastore containing YANG-defined data. This can be done in a
simplified manner, compatible with HTTP and RESTful design principles.
Since NETCONF protocol operations are not relevant, the user should
not need any prior knowledge of NETCONF in order to use the RESTful
API.
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
or 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.
The framework and meta-model used for a RESTful 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:
datastore locking (full or partial)
candidate datastore
startup datastore
validate operation
confirmed-commit procedure
The RESTful API is not intended to replace NETCONF, but rather provide
an additional simplified interface that follows RESTful principles and
is compatible with a resource-oriented device abstraction.
The following figure shows the system components:
RESTCONF combines the simplicity of a RESTful API over HTTP
with the predictability and automation potential
of a schema-driven API.
A RESTful 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 wrt/ control
of complex networking devices:
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.
no data model richness: without a data model, the schema-level
semantics and validation constraints are not available to the
application.
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 .
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.
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, .
The following terms are defined in :
candidate configuration datastore
client
configuration data
datastore
configuration datastore
protocol operation
running configuration datastore
server
startup configuration datastore
state data
user
The following terms are defined in :
entity tag
fragment
header line
message body
method
path
query
request URI
response body
The following terms are defined in :
container
data node
key leaf
leaf
leaf-list
list
presence container (or P-container)
RPC operation (now called protocol operation)
non-presence container (or NP-container)
ordered-by system
ordered-by user
The following terms are used within this document:
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.
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 sub-resources.
datastore resource: a resource with the media type
"application/yang.datastore+xml" or
"application/yang.datastore+json". Represents a configuration
datastore.
edit operation: a RESTCONF operation on a data resource
using the POST, PUT, PATCH, or DELETE method.
event stream resource: a resource with the media type
"application/yang.stream+xml" or
"application/yang.stream+json". This resource represents
an SSE event stream. The content consists of text
using the media type "text/event‑stream". Each event represents
one <notification> message generated by the server.
It contains a conceptual system or data-model specific event
that is delivered within a notification event stream.
operation: the conceptual RESTCONF operation for a message,
derived from the HTTP method, request URI, headers, and message body.
operation resource: a resource with the media type
"application/yang.operation+xml" or
"application/yang.operation+json".
patch: a generic PATCH method on the target datastore
or data resource.
The media type of the message body content will identify
the patch type in use.
plain patch: a PATCH method where the media type
is "application/yang.data+xml" or "application/yang.data+json".
query parameter: a parameter (and its value if any),
encoded within the query component of the request URI.
requested data nodes: the set of data resources identified
by the target resource, or the "select" query parameter
if it is present.
resource: a conceptual object representing a manageable
component within a device. Refers to the resource itself of
the resource and all its sub-resources.
retrieval request: a request using the GET or HEAD methods.
target resource: the resource that is associated with
a particular message, identified by the "path" component
of the request URI.
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.
YANG 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.
YANG terminal node: a YANG node representing a leaf,
leaf-list, or anyxml definition.
A simplified graphical representation of the data model is used in
this document. The meaning of the symbols in these
diagrams is as follows:
Brackets "[" and "]" enclose list keys.
Abbreviations before data node names: "rw" means configuration
(read-write) and "ro" state data (read-only).
Symbols after data node names: "?" means an optional node and "*"
denotes a "list" and "leaf‑list".
Parentheses enclose choice and case nodes, and case nodes are also
marked with a colon (":").
Ellipsis ("...") stands for contents of subtrees that are not shown.
The RESTCONF protocol uses HTTP methods to identify
the CRUD operation requested for a particular resource.
The following table
shows how the RESTCONF operations relate to NETCONF
protocol operations:
RESTCONFNETCONFOPTIONSnoneHEADnoneGET<get-config>, <get>POST<edit-config> (operation="create")PUT<edit-config> (operation="replace")PATCH<edit-config> (operation="merge")DELETE<edit-config> (operation="delete")
The NETCONF "remove" operation attribute is not supported
by the HTTP DELETE method. The resource must exist or
the DELETE method will fail. The PATCH method is equivalent to
a "merge" operation for a plain PATCH method.
The RESTCONF protocol provides granular access control for operation
and data resources using the NETCONF Access Control Model (NACM)
. There is a specific mapping between RESTCONF operations
and NETCONF edit operations, defined in . The
resource path also needs to be converted internally by the server to
the corresponding YANG instance-identifier. Using this information,
the server can apply the NACM access control rules to RESTCONF
messages.
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 .
This section defines the RESTCONF protocol usage for
each HTTP method.
The OPTIONS method is sent by the client to
discover which methods are supported by the server
for a specific resource.
If supported, it SHOULD be implemented for all media types.
The server SHOULD implement this method, however the same information
could be extracted from the YANG modules and the RESTCONF
protocol specification.
The HEAD method is sent by the client to
retrieve just the headers that would be returned
for the comparable GET method, without the response body.
It is supported for all resource types, except operation resources.
The request MUST contain a request URI
that contains at least the entry point component.
The same query parameters supported by the GET method
are supported by the HEAD method.
The access control behavior is enforced
as if the method was GET instead of HEAD.
The server MUST respond the same as if the method
was GET instead of HEAD, except that no
response body is included.
The GET method is sent by the client to
retrieve data and meta-data for a resource.
It is supported for all resource types, except operation resources.
The request MUST contain a request URI
that contains at least the entry point component.
The server MUST NOT return any data resources for which the user
does not have read privileges.
If the user is not authorized to read any portion of
the target resource, an error response containing
a "403 Forbidden" Status-Line is returned to
the client.
If the user is authorized to read some but not all of
the target resource, the unauthorized content is omitted
from the response message body, and the authorized content
is returned to the client.
Example:
The client might request the response headers for a
JSON representation of the "library" resource:
The server might respond:
Refer to @ex-create@ for more resource creation examples.
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.
TypeDescriptionDatastoreCreate a top-level configuration data resourceDataCreate a configuration data sub-resourceOperationInvoke a protocol operation
The request MUST contain a request URI
that contains a target resource which
identifies a datastore, data, or operation resource type.
If the target resource type is a datastore or data resource,
then the POST is treated as a request to create a resource or
sub-resource. The message body is expected to contain the
content of a child resource to create within the parent (target resource).
The "insert" and "point" query parameters are supported
by the POST method for datastore and data resource types,
as specified in the YANG definition in .
If the POST method succeeds,
a "201 Created" Status-Line is returned and there is
no response message body. A "Location" header identifying
the child resource that was created MUST be present
in the response in this case.
If the user is not authorized to create the target resource,
an error response containing
a "403 Forbidden" Status-Line is returned to
the client. All other error responses are handled according to
the procedures defined in .
Example:
To create a new "jukebox" resource, the client might send:
If the resource is created, the server might respond as follows.
Note that the "Location" header line is wrapped
for display purposes only:
If the target resource type is an operation resource,
then the POST method is treated as a request to invoke that operation.
The message body (if any) is processed as the operation input
parameters. Refer to for details
on operation resources.
If the POST method succeeds, a "200 OK" Status-Line
is returned if there is a response message body, and
a "204 No Content" Status-Line is returned if there is
no response message body.
If the user is not authorized to invoke the target operation,
an error response containing
a "403 Forbidden" Status-Line is returned to
the client. All other error responses are handled according to
the procedures defined in .
Example:
In this example, the client is invoking the "play" operation
defined in the "example‑jukebox" YANG module.
A client might send a "play" request as follows:
The server might respond:
The PUT method is sent by the client to create or replace
the target resource.
The request MUST contain a request URI
that contains a target resource that
identifies the data resource to create or replace.
If the resource instance does not exist, and it represents
a valid instance the server could create with a POST request,
then the server SHOULD create it.
The message body is expected to contain the
content used to create or replace the target resource.
The "insert" and "point" query parameters are supported
by the PUT method for data resources,
as specified in the YANG definition in .
If the PUT method succeeds, a "204 No Content" Status-Line
is returned, and there is no response message body.
If the user is not authorized to create or replace the target resource
an error response containing
a "403 Forbidden" Status-Line is returned to
the client. All other error responses are handled according to
the procedures defined in .
Example:
An "album" sub-resource defined in the "example‑jukebox" YANG module
is replaced or created if it does not already exist.
To replace the "album" resource contents,
the client might send as follows.
Note that the request URI header line is wrapped
for display purposes only:
If the resource is updated, the server might respond:
The PATCH method uses the HTTP PATCH method defined
in to provide an extensible framework for
resource patching mechanisms. It is optional to implement
by the server. Each patch type needs a unique
media type. Zero or more PATCH media types MAY be supported
by the server.
The "plain patch" PATCH method is be used to create or update
a sub-resource within the target resource.
If the target resource instance does not exist, the server MUST
NOT create it.
If the PATCH method 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 the user is not authorized to alter the target resource
an error response containing
a "403 Forbidden" Status-Line is returned to
the client. All other error responses are handled according to
the procedures defined in .
Example:
To replace just the "year" field in the "album" resource
(instead of replacing the entire resource with the PUT method),
the client might send a plain patch as follows.
Note that the request URI header line is wrapped
for display purposes only:
If the field is updated, the server might respond:
The XML encoding for the same request might be:
The DELETE method is used to delete the target resource.
If the DELETE method 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" Status-Line is returned to
the client. All other error responses are handled according to
the procedures defined in .
Example:
To delete a resource such as the "album" resource,
the client might send:
If the resource is deleted, the server might respond:
Each RESTCONF operation allows zero or more query
parameters to be present in the request URI.
The specific parameters that are allowed depends
on the resource type, and sometimes the specific target
resource used in the request.
NameMethodsDescriptioncontentGETSelect config and/or non-config data resourcesdepthGETRequest limited sub-tree depth in the reply contentfilterGETBoolean notification filter for event-stream resourcesinsertPOST, PUTInsertion mode for user-ordered data resourcespointPOST, PUTInsertion point for user-ordered data resourcesselectGETRequest a subset of the target resource contentsstart-timeGETReplay buffer start time for event-stream resourcesstop-timeGETReplay buffer stop time for event-stream resources
Query parameters can be given in any order.
Each parameter can appear at most once in a request URI.
A default value may apply if the parameter is missing.
The semantics and syntax for all query parameters are
defined in the "query‑parameters" YANG grouping in .
The YANG encoding MUST be converted to URL-encoded string
for use in the request URI.
Refer to for examples of query parameter usage.
The RESTCONF protocol uses HTTP entities for messages.
A single HTTP message corresponds to a single protocol method.
Most messages can perform a single task on a single resource,
such as retrieving a resource or editing a resource.
The exception is the PATCH method, which allows multiple datastore
edits within a single message.
Resources are represented with URIs following the structure
for generic URIs in .
A RESTCONF operation is derived from the HTTP method
and the request URI, using the following conceptual fields:
method: the HTTP method identifying the RESTCONF operation
requested by the client, to act upon the target resource
specified in the request URI. RESTCONF operation details are
described in .
entry: the well-known RESTCONF entry point ("/restconf").
resource: the path expression identifying the resource
that is being accessed by the operation.
If this field is not present, then the target resource
is the API itself, represented by the media type "application/yang.api".
query: the set of parameters associated with the RESTCONF
message. These have the familiar form of "name=value" pairs.
There is a specific set of parameters defined,
although the server MAY choose to support additional
parameters not defined in this document.
The contents of the any query parameter value MUST be encoded
according to , section 3.4. Any reserved characters
MUST be encoded with escape sequences, according to ,
section 2.4.
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 this exact path identifier to access
the resource once it has been created.
The "target" of an operation is a resource.
The "path" field in the request URI represents
the target resource for the operation.
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 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 tables summarize the headers most relevant
in RESTCONF message requests:
NameDescriptionAcceptResponse Content-Types that are acceptableContent-TypeThe media type of the request bodyHostThe host address of the serverIf-MatchOnly perform the action if the entity matches ETagIf-Modified-SinceOnly perform the action if modified since timeIf-Unmodified-SinceOnly perform the action if un-modified since time
The following tables summarize the headers most relevant
in RESTCONF message responses:
NameDescriptionAllowValid actions when 405 error returnedCache-ControlThe cache control parameters for the responseContent-TypeThe media type of the response bodyDateThe date and time the message was sentETagAn identifier for a specific version of a resourceLast-ModifiedThe last modified date and time of a resourceLocationThe resource identifier for a newly created resource
RESTCONF messages are encoded in HTTP according to RFC 2616.
The "utf‑8" character set is used for all messages.
RESTCONF message content is sent in the HTTP message body.
Content is encoded in either JSON or XML format.
XML encoding rules for data nodes are defined in .
The same encoding rules are used for all XML content.
JSON encoding rules are defined in .
This encoding is valid JSON, but also has
special encoding rules 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
by the client.
Response output content encoding format is identified with the 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.
The RESTCONF protocol needs to retrieve the same meta-data that is
used in the NETCONF protocol. Information about default leafs,
last-modified timestamps, etc. are commonly used to annotate
representations of the datastore contents. This meta-data
is not defined in the YANG schema because it applies to the
datastore, and is common across all data nodes.
This information is encoded as attributes in XML, but JSON
does not have a standard way of attaching non-schema defined
meta-data to a resource.
The YANG to JSON mapping does not support
attributes because YANG does not support meta-data in data node
definitions. This section specifies how RESTCONF meta-data is
encoded in JSON.
Only simple meta-data is supported:
A meta-data instance can appear 0 or 1 times for a particular
data node
A meta-data instance associated with a resource is
encoded as if it were a YANG leaf of type "string",
according to the encoding rules in ,
except the identifier is prepended with a "@" (%40) character.
A meta-data instance associated with a YANG leaf or leaf-list
within a resource is encoded as if it were a container for the meta-data values
and the resource value in its native encoding. It is encoded
according to the rules in ,
except the meta-data identifiers are prepended with a "@" (%40) character.
The resource name/value pair is repeated inside this container,
which contains the actual value of the resource.
Example:
The client is retrieving the "top" data resource, and the server
is including datastore meta-data. Note that a query parameter to request
or suppress specific meta-data is not provided in RESTCONF.
The server might respond as follows:
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 is returned in the Status-Line,
then the error information will be returned in the response,
according to the format defined in .
Since the datastore contents change at unpredictable times,
responses from a RESTCONF server generally SHOULD NOT be cached.
The server SHOULD include a "Cache‑Control" header in every response
that specifies whether the response should be cached. A "Pragma"
header specifying "no‑cache" MAY also be sent in case the
"Cache‑Control" header is not supported.
Instead of using HTTP caching, the client SHOULD track the "ETag"
and/or "Last‑Modified" headers returned by the server for the
datastore resource (or data resource if the server supports it).
A retrieval request for a resource can include
the "If‑None‑Match" and/or "If‑Modified‑Since" headers, which
will cause the server to return a "304 Not Modified" Status-Line
if the resource has not changed.
The client MAY use the HEAD method to retrieve just
the message headers, which SHOULD include the "ETag"
and "Last‑Modified" headers, if this meta-data is maintained
for the target resource.
The RESTCONF protocol operates on a hierarchy of resources,
starting with the top-level API resource itself. Each resource
represents a 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
child nodes that are nested resources.
The 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 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 additional 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.
The RESTCONF protocol defines some application specific media types
to identify each of the available resource types. The following
resource types are defined in RESTCONF:
ResourceMedia TypeAPIapplication/yang.apiDatastoreapplication/yang.datastoreDataapplication/yang.dataOperationapplication/yang.operationSchemaapplication/yangStreamapplication/yang.stream
A client SHOULD start by retrieving the top-level
API resource, using the entry point URI "/restconf".
The RESTCONF protocol does not include a
resource discovery mechanism. Instead, the definitions
within the YANG modules advertised by the server
are used to construct a predictable operation or data
resource identifier.
The "depth" query parameter can be used to control how many
descendant levels should be included when retrieving
sub-resources. This parameter can be used with the GET method
to discover sub-resources within a particular resource.
The API resource contains the state and access points for
the RESTCONF features.
It is the top-level resource and has the media type
"application/yang.api+xml" or "application/yang.api+json".
It is accessible through the well-known relative
URI "/restconf".
YANG Tree Diagram for "application/yang.api" Resource Type:
The "restconf" container definition in the "ietf‑restconf" module
defined in is used to specify the structure and syntax
of the conceptual sub-resources within the API resource.
This resource has the following child resources:
Child ResourceDescriptiondataContains all data resourcesmodulesYANG module informationoperationsData-model specific operationsstreamsNotification event streamsversionRESTCONF API version
This mandatory resource represents the combined configuration
and operational data resources that can be accessed by a client.
It cannot be created or deleted by the client.
The datastore resource type is defined in .
Example:
This example request by the client
would retrieve only the non-configuration data nodes
that exist within the "library" resource, using the "content"
query parameter.
The server might respond:
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 is retrieved with the GET or HEAD methods.
The server SHOULD maintain an entity-tag for this
resource, and return the "ETag" header when this
resource is retrieved with the GET or HEAD methods.
This mandatory resource contains one list entry
for each YANG data model module supported by the server.
There MUST be an instance of this resource for every
YANG module that is accessible via an operation resource
or a data resource.
The contents of the "module" resource are defined in
the "module" YANG list statement in .
The server MAY maintain a last-modified timestamp for
each instance of this resource, and return the
"Last‑Modified" header when this resource is retrieved
with the GET or HEAD methods. If not supported
then the timestamp for the parent "modules" resource
MAY be used instead.
The server MAY maintain an entity-tag for each instance
of this resource, and return the "ETag" header when this
resource is retrieved with the GET or HEAD methods.
If not supported then the timestamp for the
parent "modules" resource MAY be used instead.
This optional resource is a container that provides access to the
data-model specific protocol operations supported by the server.
The server MAY omit this resource if no data-model specific
operations are advertised.
Any data-model specific operations defined in the YANG
modules advertised by the server MAY be available
as child nodes of this resource.
Operation resources are defined in .
This optional resource is a container that provides access to the
notification event streams supported by the server.
The server MAY omit this resource if no
notification event streams are supported.
The media type for this resource 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 is "application/yang.stream".
Stream resources are defined in .
Notifications are defined in .
This sub-resource can be used by the client to identify the exact
version of the RESTCONF protocol implemented by the server.
The same server-wide response MUST be returned
each time this resource is retrieved.
The value is assigned by the server when the server is started.
The server MUST return the value "1.0" for this
version of the RESTCONF protocol.
This resource is encoded with the rules for an "enumeration" data type,
using the "version" leaf definition in .
The /restconf/data subtree represents the datastore resource type,
which is a collection of configuration and operational data nodes.
A "unified datastore" interface is used to simplify resource
editing for the client. The RESTCONF unified datastore is a
conceptual interface to the native configuration datastores
that 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 to the exact datastore procedures defined
in NETCONF.
The "candidate" and "startup" datastores are not visible
in the RESTCONF protocol. Transaction management and
configuration persistence are handled by the server
and not controlled by the client.
Two "edit collision detection" mechanisms are provided
in RESTCONF, for datastore and data resources.
The last change time is maintained and
the "Last‑Modified" and "Date" headers are returned in the
response for a retrieval request.
The "If‑Unmodified‑Since" header can be used
in edit operation requests to cause the server
to reject the request if the resource has been modified
since the specified timestamp.
The server MUST maintain a last-modified timestamp for this
resource, and return the "Last‑Modified" header when this
resource is retrieved with the GET or HEAD methods.
Only changes to configuration data resources within
the datastore affect this timestamp.
A unique opaque string is maintained and
the "ETag" header is returned in the
response for a retrieval request.
The "If‑Match" header can be used
in edit operation requests to cause the server
to reject the request if the resource entity tag
does not match the specified value.
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 HEAD methods.
The resource entity tag MUST be changed to a new
previously unused value if changes to any configuration
data resources within the datastore are made.
A datastore resource can only be written directly with
the PATCH method. Only the configuration data resources
within the datastore resource can be edited directly with
all methods.]
Each RESTCONF edit of 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 that the saved configuration
is always a mirror of the running configuration.
A data resource represents a YANG data node that is a descendant
node of a datastore resource.
For configuration data resources,
the server MAY maintain a last-modified timestamp for the
resource, and return the "Last‑Modified" header when it
is retrieved with the GET or HEAD methods.
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 the GET or HEAD methods.
If maintained, the resource entity tag MUST be changed to a new
previously unused value if changes to the resource
or any configuration resource within the resource is altered.
A data resource can be retrieved with the GET method.
Data resources
can be accessed via the "/restconf/data" entry point.
This sub-tree is used to retrieve and edit data resources.
A configuration data resource can be altered by the client
with some of all of the edit operations, depending on the
target resource and the specific operation. Refer to
for more details on edit operations.
The resource definition version for a data resource
is identified by the revision date of the YANG module
containing the YANG definition for the data resource,
specified in the /restconf/modules sub-tree.
In YANG, data nodes are named with an absolute
XPath expression, defined in , starting
from the document root to 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 the path expression format defined
in this section.
NameCommentspointInsertion point is always a full i-ipathRequest URI path is a full or partial i-i
The "path" component of the request URI contains the
absolute path expression that identifies the
target resource.
A predictable location for a data resource
is important, since applications will code to the YANG
data model module, which uses static naming and defines an
absolute path location for all data nodes.
A RESTCONF data resource identifier is not an XPath expression.
It is encoded from left to right, starting with the top-level
data node, according to the "api‑path" rule in .
The node name of each ancestor of the target resource node
is encoded in order, ending with the node name for the
target resource.
If a data node in the path expression is a YANG list node,
then the key values for the list (if any) are encoded
according to the "key‑value" rule. If the list node
is the target resource, then the key values MAY be omitted,
according to the operation. For example, the POST
method to create a new data resource for a list node
does not allow the key values to be present in the request URI.
The key leaf values for a data resource representing a YANG list
MUST be encoded as follows:
The value of each leaf identified in the "key" statement
is encoded in order.
All the components in the "key" statement MUST be encoded.
Partial instance identifiers are not supported.
Each value is encoded using the "key‑value" rule in ,
according to the encoding rules for the data type of the key leaf.
An empty string can be a valid key value
(e.g., "/top/list/key1//key3").
The "/" character MUST be URL-encoded (i.e., "%2F").
All whitespace MUST be URL-encoded.
A "null" value is not allowed since the "empty" data type is
not allowed for key leafs.
The XML encoding is defined in .
The JSON encoding is defined in .
The entire "key‑value" MUST be properly URL-encoded,
according to the rules defined in .
resource URI values returned in Location headers
for data resources MUST identify the module name, even
if there are no conflicting local names when the resource
is created. This ensures the correct resource will be identified
even if the server loads a new module that the old client
does not know about.
Examples:
The following ABNF syntax is used to construct RESTCONF
path identifiers:
NETCONF has a rather complex model for handling default values for
leafs. RESTCONF attempts to avoid this complexity by
restricting the operations that can be applied to
a resource.
If the target of a GET method is a data node
that represents a leaf that has a default value,
and the leaf has not been given a value yet, the server MUST
return the default value that is in use by the server.
If the target of a GET method is a data node
that represents a container or list that has any sub-resources
with default values, for the sub-resources that have not been given
value yet, the server MAY
return the default values that are in use by the server.
An operation resource represents an protocol operation
defined with 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 a top-level
data resource defined within the same module.
If 2 different YANG modules define the same "rpc" identifier,
then the module name MUST be used 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 be requested as follows:
Any usage of an operation resource from the same module,
with the same name, refers to the same "rpc" statement
definition. This behavior can be used to design protocol operations
that perform the same general function on different
resource types.
If the "rpc" statement has an "input" section, then a message body
MAY be sent by the client in the request, otherwise the request
message MUST NOT include a message body.
If the "rpc" statement has an "output" section, then a message body
MAY be sent by the server in the response. Otherwise the
server MUST NOT include a message body in the response message,
and MUST send a "204 No Content" Status-Line instead.
If the "rpc" statement has an "input" section, then
the "input" node is provided in the message body,
corresponding to the YANG data definition statements
within the "input" section.
Example:
The following YANG definition is used for the examples in this
section.
The client might send the following POST request message:
The server might respond:
If the "rpc" statement has an "output" section, then
the "output" node is provided in the message body,
corresponding to the YANG data definition statements
within the "output" section.
Example:
The following YANG definition is used for the examples in this
section.
The client might send the following POST request message:
The server might respond:
If the server supports the "schema" leaf within the API then
the client can retrieve the YANG schema text for the associated
YANG module or submodule, using the GET method.
The client might send the following GET request message:
The server might respond:
A stream resource represents a source for system generated
event notifications. Each stream is created and modified
by the server only. A client can retrieve a stream resource
or initiate a long-poll server sent event stream,
using the procedure specified in .
A notification stream functions according to the NETCONF
Notifications specification . The "ietf‑restconf"
YANG module contains the "stream" list (/restconf/streams/stream)
which specifies the syntax and semantics of a stream resource.
The RESTCONF protocol supports YANG-defined event notifications.
The solution preserves aspects of NETCONF Event Notifications
while utilizing the Server-Sent Events transport strategy.
A RESTCONF server is not required to support RESTCONF notifications.
Clients may determine if a server supports RESTCONF notifications by
using the HTTP operation OPTIONS, HEAD, or GET on the
"/restconf/streams" resource described below.
The server does not support RESTCONF notifications if an HTTP error
code is returned (e.g. 404 Not Found).
A RESTCONF server that supports notifications will populate a
stream resource for each notification delivery service access point.
A RESTCONF client can retrieve the list of supported event streams from
a RESTCONF server using the GET operation on the "/restconf/streams"
resource.
The "/restconf/streams" container definition in the "ietf‑restconf" module
defined in is used to specify the structure and syntax
of the conceptual sub-resources within the "streams" resource.
For example:
The client might send the following request:
The server might send the following response:
RESTCONF clients can subscribe to receive notifications by sending an
HTTP GET request for the "/restconf/streams/stream/<stream‑name>" resource,
with the "Accept" type "text/event‑stream".
The server will treat the connection as an event stream, using the
Server Sent Events transport strategy.
The server MAY support query parameters for a GET method on this
resource. These parameters are specific to each notification stream.
For example:
A RESTCONF client MAY request the server compress the events using
the HTTP header field "Accept‑Encoding". For instance:
The server SHOULD support the "NETCONF" notification stream
defined in . For this stream,
RESTCONF notification subscription requests MAY specify parameters
indicating the events it wishes to receive.
NameDescriptionstart-timereplay event start timestop-timereplay event stop timefilterboolean content filter
The semantics and syntax for these query parameters are
defined in the "query‑parameters" YANG grouping in .
The YANG encoding MUST be converted to URL-encoded string
for use in the request URI.
Refer to for filter parameter examples.
RESTCONF notifications are encoded according to the
definition of the event stream. The NETCONF stream
defined in is encoded in XML format.
The structure of the event data is based on the "notification"
element definition in section 4 of . It MUST
conform to the "notification" YANG container definition in .
An example SSE notification encoded using XML:
Since XML is not whitespace sensitive,
the above message can be encoded onto a single line.
For example: ('\' line wrapping added for formatting only)
The SSE specifications supports the following additional fields:
event, id and retry. A RESTCONF server MAY send the "retry" field
and, if it does, RESTCONF clients SHOULD use it.
A RESTCONF server SHOULD NOT send the "event" or "id" fields,
as there are no meaningful values that could be used for them
that would not be redundant to the contents of the notification itself.
RESTCONF servers that do not send the "id" field also do not need
to support the HTTP header "Last‑Event‑Id". RESTCONF servers that
do send the "id" field MUST still support the "startTime" query
parameter as the preferred means for a client to specify where to
restart the event stream.
HTTP Status-Lines are used to report success or failure
for 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.
The following table summarizes the return status codes
used specifically by RESTCONF operations:
Status-LineDescription100 ContinuePOST accepted, 201 should follow200 OKSuccess with response body201 CreatedPOST to create a resource success202 AcceptedPOST to create a resource accepted204 No ContentSuccess without response body304 Not ModifiedConditional operation not done400 Bad RequestInvalid request message403 ForbiddenAccess to resource denied404 Not FoundResource target or resource node not found405 Method Not AllowedMethod not allowed for target resource409 ConflictResource or lock in use412 Precondition FailedConditional method is false413 Request Entity Too Largetoo-big error414 Request-URI Too Largetoo-big error415 Unsupported Media Typenon RESTCONF media type500 Internal Server Erroroperation-failed501 Not Implementedunknown-operation503 Service UnavailableRecoverable server error
Since an operation resource is defined with a YANG "rpc"
statement, a mapping between the NETCONF <error‑tag> value
and the HTTP status code is needed. The specific error
condition and response code to use are data-model specific
and might be contained in the YANG "description" statement
for the "rpc" statement.
<error‑tag>status codein-use409invalid-value400too-big413missing-attribute400bad-attribute400unknown-attribute400bad-element400unknown-element400unknown-namespace400access-denied403lock-denied409resource-denied409rollback-failed500data-exists409data-missing409operation-not-supported501operation-failed500partial-operation500malformed-message400
When an error occurs for a request message on a data resource
or an operation resource, and a "4xx" class of status codes
(except for status code "403"),
then the server SHOULD send a response body containing
the information described by the "errors" container definition
within the YANG module .
YANG Tree Diagram for <errors> Data:
The semantics and syntax for RESTCONF error messages are
defined in the "errors" YANG grouping in .
Examples:
The following example shows an error returned for
an "lock‑denied" error on a datastore resource.
The server might respond:
The following example shows an error returned for
a "data‑exists" error on a data resource.
The "jukebox" resource already exists so it cannot be created.
The client might send:
The server might respond:
The "ietf‑restconf" module defines conceptual definitions
within groupings, which are not meant to be implemented
as datastore contents by a server.
The "ietf‑yang‑types" and "ietf‑inet_types" modules from
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@2013-12-21.yang"<CODE ENDS>
This document registers one URI in the IETF XML registry
. Following the format in RFC 3688, the following
registration is requested to be made.
This document registers one YANG module in the YANG Module Names
registry .
The parent MIME media type for RESTCONF resources is application/yang,
which is defined in . This document defines the following
sub-types for this media type.
TBD
Key words for use in RFCs to Indicate Requirement LevelsHarvard UniversityIn many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents.Uniform Resource Identifiers (URI): Generic SyntaxWorld Wide Web ConsortiumMIT Laboratory for Computer Science, NE43-356545 Technology SquareCambridgeMA02139+1(617)258-8682timbl@w3.orgDepartment of Information and Computer ScienceUniversity of California, IrvineIrvineCA92697-3425+1(949)824-1715fielding@ics.uci.eduXerox PARC3333 Coyote Hill RoadPalo AltoCA94034+1(415)812-4333masinter@parc.xerox.com
Applications
uniform resourceURI
A Uniform Resource Identifier (URI) is a compact string of characters
for identifying an abstract or physical resource. This document
defines the generic syntax of URI, including both absolute and
relative forms, and guidelines for their use; it revises and replaces
the generic definitions in RFC 1738 and RFC 1808.
This document defines a grammar that is a superset of all valid URI,
such that an implementation can parse the common components of a URI
reference without knowing the scheme-specific requirements of every
possible identifier type. This document does not define a generative
grammar for URI; that task will be performed by the individual
specifications of each URI scheme.
This paper describes a "superset" of operations that can be applied
to URI. It consists of both a grammar and a description of basic
functionality for URI. To understand what is a valid URI, both the
grammar and the associated description have to be studied. Some of
the functionality described is not applicable to all URI schemes, and
some operations are only possible when certain media types are
retrieved using the URI, regardless of the scheme used.
Hypertext Transfer Protocol -- HTTP/1.1Department of Information and Computer ScienceUniversity of California, IrvineIrvineCA92697-3425+1(949)824-1715fielding@ics.uci.eduWorld Wide Web ConsortiumMIT Laboratory for Computer Science, NE43-356545 Technology SquareCambridgeMA02139+1(617)258-8682jg@w3.orgCompaq Computer CorporationWestern Research Laboratory250 University AvenuePalo AltoCA94305mogul@wrl.dec.comWorld Wide Web ConsortiumMIT Laboratory for Computer Science, NE43-356545 Technology SquareCambridgeMA02139+1(617)258-8682frystyk@w3.orgXerox CorporationMIT Laboratory for Computer Science, NE43-3563333 Coyote Hill RoadPalo AltoCA94034masinter@parc.xerox.comMicrosoft Corporation1 Microsoft WayRedmondWA98052paulle@microsoft.comWorld Wide Web ConsortiumMIT Laboratory for Computer Science, NE43-356545 Technology SquareCambridgeMA02139+1(617)258-8682timbl@w3.org
The Hypertext Transfer Protocol (HTTP) is an application-level
protocol for distributed, collaborative, hypermedia information
systems. It is a generic, stateless, protocol which can be used for
many tasks beyond its use for hypertext, such as name servers and
distributed object management systems, through extension of its
request methods, error codes and headers . A feature of HTTP is
the typing and negotiation of data representation, allowing systems
to be built independently of the data being transferred.
HTTP has been in use by the World-Wide Web global information
initiative since 1990. This specification defines the protocol
referred to as "HTTP/1.1", and is an update to RFC 2068 .
The IETF XML RegistryThis document describes an IANA maintained registry for IETF standards which use Extensible Markup Language (XML) related items such as Namespaces, Document Type Declarations (DTDs), Schemas, and Resource Description Framework (RDF) Schemas.Uniform Resource Identifier (URI): Generic SyntaxWorld Wide Web ConsortiumMassachusetts Institute of Technology77 Massachusetts AvenueCambridgeMA02139USA+1-617-253-5702+1-617-258-5999timbl@w3.orghttp://www.w3.org/People/Berners-Lee/Day Software5251 California Ave., Suite 110IrvineCA92617USA+1-949-679-2960+1-949-679-2972fielding@gbiv.comhttp://roy.gbiv.com/Adobe Systems Incorporated345 Park AveSan JoseCA95110USA+1-408-536-3024LMM@acm.orghttp://larry.masinter.net/
Applications
uniform resource identifierURIURLURNWWWresource
A Uniform Resource Identifier (URI) is a compact sequence of characters
that identifies an abstract or physical resource. This specification
defines the generic URI syntax and a process for resolving URI references
that might be in relative form, along with guidelines and security
considerations for the use of URIs on the Internet.
The URI syntax defines a grammar that is a superset of all valid URIs,
allowing an implementation to parse the common components of a URI
reference without knowing the scheme-specific requirements of every
possible identifier. This specification does not define a generative
grammar for URIs; that task is performed by the individual
specifications of each URI scheme.
NETCONF Event NotificationsNortelCiscoYANG is a data modeling language used to model configuration and state data manipulated by the Network Configuration Protocol (NETCONF), NETCONF remote procedure calls, and NETCONF notifications. [STANDARDS TRACK]PATCH Method for HTTPSeveral applications extending the Hypertext Transfer Protocol (HTTP) require a feature to do partial resource modification. The existing HTTP PUT method only allows a complete replacement of a document. This proposal adds a new HTTP method, PATCH, to modify an existing HTTP resource. [STANDARDS-TRACK]Network Configuration Protocol (NETCONF)YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)YANG is a data modeling language used to model configuration and state data manipulated by the Network Configuration Protocol (NETCONF), NETCONF remote procedure calls, and NETCONF notifications. [STANDARDS TRACK]Network Configuration Protocol (NETCONF) Access Control ModelThe standardization of network configuration interfaces for use with the Network Configuration Protocol (NETCONF) requires a structured and secure operating environment that promotes human usability and multi-vendor interoperability. There is a need for standard mechanisms to restrict NETCONF protocol access for particular users to a pre-configured subset of all available NETCONF protocol operations and content. This document defines such an access control model. [STANDARDS-TRACK]Modeling JSON Text with YANGCZ.NICCommon YANG Data TypesThis document introduces a collection of common data types to be used with the YANG data modeling language. This document obsoletes RFC 6021.Server-Sent EventsGoogle Inc.This specification defines an API for opening an HTTP connection for receiving push notifications from a server in the form of DOM events. The API is designed such that it can be extended to work with other push notification schemes such as Push SMS.Extensible Markup Language (XML) 1.0 (Fifth Edition)The JSON Data Interchange FormatXML Path Language (XPath) Version 1.0
Move YANG Patch to separate document
Remove some introduction text
Move most framework text into other sections
Move notifications into its own section
Remove fields; all YANG node types are sub-resources
Add schema retrieval via /restconf/modules/module/schema resource
Add submodule support to /restconf/modules/module resource
Move some examples to appendix
Add canonical representation for data-resource-identifier typedef
Move query string definitions to YANG module
Removed "format" query parameter
Removed user-selected XML/JSON encoding for events.
Event streams define a fixed encoding. It is not user-configurable.
Clarified that query parameters for SSE event streams are specific
to the stream definition; start-time, stop-time, and filter only apply
to the NETCONF stream;
Change operation input and output media type from application/yang.data
to application/yang.data.
Fix some bugs and typos
Added Notification Model (section 2.2)
Remove error-action from YANG Patch
Add "comment" and "ok" leafs to yang-patch-status container
Fixed YANG Patch JSON example syntax
Added stream resource type and streams container
to /restconf container
Removed "vnd" from media type definitions
Changed yang-patch edit list from ascending uint32 key to
an arbitrary string key and an ordered-by user list.
Several clarifications and corrections
Add YANG tree diagrams
Add application/yang.patch-status media type
Remove redundant "global‑errors" container from
"yang‑patch‑status" container
Split the /restconf/datastore entry point into 2 entry
points (config and operational)
Remove the "config" parameter since it is no longer needed
after datastore is split
Removed incorrect /.well-known URI prefix.
Remove incorrect IANA request for well-known URI.
Clarified that API resource type nodes are defined in
the ietf-restconf namespace.
Changed CamelCase names in example-jukebox.yang to lowercase,
and updated examples.
Updated and corrected YANG types in ietf-restconf module.
Protocol renamed from YANG-API to RESTCONF
Fields are clarified. Containers and lists are
sub-resources. All other YANG data node types are fields
within a parent resource.
The 'optional‑key' YANG extension has been removed.
The default value is returned by the server if the target resource
represents a missing data node but the server is using a default value
for the leaf.
The default for the 'depth' parameter has been changed from '1'
to 'unbounded'. The depth is only limited if an integer value
for this parameter is specified by the client.
The default for the 'format' parameter has been changed from
'json' to 'xml'.
expanded introduction
removed transactions
removed capabilities
removed usage of Range and IfRange headers
simplified editing model
removed global protocol operations from ietf-restconf.yang
changed RPC operation terminology to protocol operation
updated JSON draft reference
updated IANA section
added YANG Patch
added YANG definitions to ietf-restconf.yang
added Kent Watsen and Rex Fernando as co-authors
updated YANG modules so they pass pyang --ietf checking
changed examples so resource URIs use the module name variant
to identify data resources
changed depth behavior so the entire server contents are not
returned for "GET /restconf"; Server will stop at new
resource type; e.g. yang.api --> yang.datastore returns
the datastore as an empty node;
yang.api --> yang.operation returns
the operation name as an empty node;
There is no "message‑id" field in a RESTCONF message.
Is a message identifier needed? If so, should either the "Message‑ID"
or "Content‑ID" header from RFC 2392 be used for this purpose?
What syntax should be used for the "select" query parameter?
The current choices are "XPath" and "path‑expr". Perhaps an additional
parameter to identify the select string format is needed
to allow extensibility?
Are all header lines used by RESTCONF supported by common application
frameworks, such as FastCGI and WSGI? If not, then should
query parameters be used instead, since the QUERY_STRING is
widely available to WEB applications?
Should the <errors> element returned in error responses
be a separate media type?
How should additional datastores be supported, which may be added to the
NETCONF/NETMOD framework in the future?
How does a client know which PATCH media types are supported
by the server in addition to application/yang.data and
application/yang.patch?
Is the /restconf/version field considered meta-data?
Should it be returned as XRD (Extensible Resource Descriptor)?
In addition or instead of the version field? Should this be
the ietf-restconf YANG module revision date, instead of the string 1.0?
Since data resources can only be YANG containers or lists,
what should be done about top-level YANG data nodes that are
not containers or lists? Are they allowed in RESTCONF?
Can a choice be a resource? YANG choices are invisible
to RESTCONF at this time.
Does RESTCONF need to Use a .well-known link relation to
to re-map API entry point?
The client first discovers the server's root for the RESTCONF API.
In this example, it is "/api/restconf":
Once discovering the RESTCONF API root, the client MUST
prepend it to any access to a RESTCONF resource:
Should there be a mode where the client can request that
the resource identifier is returned in a GET request?
Should long-term RESTCONF operations (i.e. SSE long-poll)
be considered sessions wrt/ NETCONF monitoring "session" list?
If so, what text is needed in RESTCONF draft to standardize
the RESTCONF session entries?
Details to support secure operation over TLS are needed
Security considerations need to be written
The example YANG module used in this document represents
a simple media jukebox interface.
YANG Tree Diagram for "example‑jukebox" Module
The examples within this document use the normative
YANG module defined in and the non-normative
example YANG module defined in .
This section shows some typical RESTCONF message exchanges.
The client may start by retrieving the top-level
API resource, using the entry point URI "/restconf".
The server might respond as follows:
To request that the response content to be encoded in XML,
the "Accept" header can be used, as in this example request:
The server will return the same response either way,
which might be as follows :
In this example the client is retrieving the modules
resource from the server in JSON format:
The server might respond as follows.
To create a new "artist" resource within the "library"
resource, the client might send the following request.
If the resource is created, the server might respond as follows.
Note that the "Location" header line is wrapped
for display purposes only:
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:
If the resource is created, the server might respond
as follows. Note that the "Location" header line is wrapped
for display purposes only:
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 replace a list entry
with key value "11":
In this example the datastore resource has changed
since the time specified in the "If‑Unmodified‑Since"
header. The server might respond:
The "content" parameter is used to select the type of
data sub-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 sub-resources.
Example 1: content=all
To retrieve all the sub-resources, the "content" parameter
is set to "all". The client might send:
The server might respond:
Example 2: content=config
To retrieve only the configuration sub-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".
The server might respond:
Example 3: content=non-config
To retrieve only the non-configuration sub-resources,
the "content" parameter is set to "non‑config". Note
that configuration ancestors (if any) and list key leafs
(if any) are also returned. The client might send:
The server might respond:
The "depth" parameter is used to limit the number of levels
of sub-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 sub-resources, the "depth" parameter
is not present or set to the default value "unbounded".
Note that some strings are wrapped for display purposes only.
The server might respond:
Example 2: depth=1
To determine if 1 or more resource instances exist for
a given target resource, the value "1" is used.
The server might respond:
Example 3: depth=3
To limit the depth level to the target resource plus 2 sub-resource layers
the value "3" is used.
The server might respond:
The following URIs show some examples of notification filter
specifications (lines wrapped for display purposes only):
In this example, a new first entry in the "Foo‑One" playlist
is being created.
Request from client:
Response from server:
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:
Response from server:
TBD
TBD
TBD