ConfD User Community

RESTCONF Filtering(Netconf Filtering)

Hello Folks,

Nowadays, i’m working on filtering on get request. i could succesfully do it by using this netconf command:

<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
...
    <filter>
      <config xmlns="urn:ietf:params:xml:ns:yang:kea-dhcp4-server">
        <subnet4>
          <id>2</id> 
        </subnet4>
      </config>
    </filter>
...
</rpc>

i can filter result according to id value or according to any value.
How can i do this in restconf ?
I couldn’t find exact way.

Many Thanks in advance.
With My Best Regards.

The RESTCONF standard is a bit limited in this respect, but some filtering is still possible. Since id is the key of the list subnet4, the path part can look like

restconf/data/kea-dhcp4-server:config/subnet4=2

For more complex filters though you would have to resort to ConfD’s query API, see the corresponding section in the RESTCONF chapter of the user guide.

Hello mvf,

thanks for your answer.
I got it. And also I read more more RFCs. I couldn’t see it. There is no filtering on restconf, even netconf has subtree filtering mechanism, resting has not.
I saw tail-f query APIs. they are very helpfull. but I guess, it contains only exact match filtering not other filter mechanism, right.

Many thanks.

But RESTCONF has (limited) subtree filtering - that’s what my example tries to show: just provide a path to the relevant subtree as a part of the GET request url.

The query API provides complete XPath filtering (and a bit more) - not sure if that’s what you mean by “exact match filtering”.

Hello mvf,

while i’m sayin “exact match filtering”, i mean like this:
let’s assume that,
you have words like this “example, mample, temple”,
if you make “exact match filter” with “ampl” you get empty result,
if you make “exact match filter” with “example” you get with “example”.
if you make “contains match filter” with “ampl” you get result with “example, mample”.

In that case no, you have almost complete XPath 1.0 arsenal at your disposal, including string functions like contains(). So you can do more than just “exact match”.