Subject: [Netconf] restconf selecting encoding for notifications

From: Juergen Schoenwaelder <[email-masked]>
Date: Fri, 27 Mar 2015 02:06:59 +0100

Hi,

how do I select in RESTCONF in which encoding I like to receive
notifications?

/js

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103         <http://www.jacobs-university.de/>

---

From: Andy Bierman <[email-masked]>
Date: Thu, 26 Mar 2015 21:10:07 -0500

> how do I select in RESTCONF in which encoding I like to receive

You pick the URI that corresponds to the stream encoding you
want.  There is no requirement that the server support any
particular streams or encoding formats:

   <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>
            <encoding>
               <type>xml</type>
               <events>https://example.com/streams/NETCONF</events>
            </encoding>
            <encoding>
               <type>json</type>
               <events>https://example.com/streams/NETCONF-JSON</events>
            </encoding>
         </stream>
         ....

Note that there is a bug in sec. 6.3 that shows the "encoding=foo"
query parameter (which has been removed).

-----
 The client might send the following request:

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

   The server might send the following response:

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

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

> /js

Andy

> _______________________________________________
> Netconf mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netconf

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Fri, 27 Mar 2015 04:10:14 +0100

On Thu, Mar 26, 2015 at 09:10:07PM -0500, Andy Bierman wrote:
> want.

[...]

>       Accept: application/yang.data+xml

So I would do this:

      GET /restconf/data/ietf-restconf-monitoring:restconf-state/
         streams/stream=NETCONF/encoding=json/events HTTP/1.1
      Host: example.com
      Accept: application/yang.data+xml

Makes sense now. Thanks,

/js

---

From: Phil Shafer <[email-masked]>
Date: Fri, 27 Mar 2015 19:10:35 -0400

>      Accept: application/yang.data+xml

Is the "json" in the GET line a typo?  Can you "accept" a
different format from the URL's encoding?  Seems strange to
have both and stranger when they disagree?

Thanks,
 Phil

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Sat, 28 Mar 2015 09:43:38 +0100

> have both and stranger when they disagree?

This request returns the stream. A subsequent GET request on the
returned stream yields the event notifications. This subsequent
request must be Accept: text/event-stream according to W3C and hence
you can't pass an encoding indicator in this request. Yep, a bit ugly,
but looks like W3C is to blame here.

/js

PS: http://www.w3.org/TR/eventsource/

---

From: Phil Shafer <[email-masked]>
Date: Sun, 29 Mar 2015 22:40:59 -0400

>PS: http://www.w3.org/TR/eventsource/

Very cool.  Can we have the draft add a reference to this TR?

Thanks,
 Phil