# How to make a Netconf xml request which can fetch all rows in a list

**URL:** <https://dmap-community.ductus.global/t/how-to-make-a-netconf-xml-request-which-can-fetch-all-rows-in-a-list/2253>\
**Category:** NETCONF\
**Created:** [January 29, 2019, 8:55pm UTC](https://dmap-community.ductus.global/t/how-to-make-a-netconf-xml-request-which-can-fetch-all-rows-in-a-list/2253 "2019-01-29T20:55:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![buddha87](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@buddha87](https://dmap-community.ductus.global/u/buddha87)\
**Post date:** [January 29, 2019, 8:55pm UTC](https://dmap-community.ductus.global/t/how-to-make-a-netconf-xml-request-which-can-fetch-all-rows-in-a-list/2253/1 "2019-01-29T20:55:05Z")

</div>

I have defined a list for operational data 🙂

> Blockquote  
> list listener-state {  
> key “listener-name”;  
> config false;  
> description  
> “common statistics for given listener (i.e sent messages)”;  
> tailf:info  
> “common statistics for given listener (i.e sent messages)”;  
> uses listener-state-info;  
> …  
> }

I try to send a Netconf xml request to fetch all the rows in this list.  
Assume there are two rows in the table, one row with key : “first”, and the other row with key : “second”. If I want to fetch these two rows 🙂 , xml request will be something like

first second

But in this case, I have to know the key values.  
Is there any approach I can send a xml request which fetch all rows in the list but no need to know keys ?  
I know there is a way to get all key values then send xml request with all key values in  
…. But this will need two requests in order to fetch all rows in list.

---

<div class="post-metadata">

**Author:** ![mvf](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mvf/32/182_2.png) [@mvf](https://dmap-community.ductus.global/u/mvf)\
**Post date:** [January 31, 2019, 12:41pm UTC](https://dmap-community.ductus.global/t/how-to-make-a-netconf-xml-request-which-can-fetch-all-rows-in-a-list/2253/2 "2019-01-31T12:41:00Z")

</div>

You do not have to provide keys when you do subtree filtering in your NETCONF message - the `get` part of the message would look something like

```auto
<nc:get xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
  <nc:filter type="subtree">
    <listener-state xmlns="http://your.name.space"/>
  </nc:filter>
</nc:get>

```

See also the NETCONF RFC, [subtree filter examples](https://tools.ietf.org/html/rfc6241#section-6.4).

---

<div class="post-metadata">

**Author:** ![buddha87](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@buddha87](https://dmap-community.ductus.global/u/buddha87)\
**Post date:** [January 31, 2019, 8:20pm UTC](https://dmap-community.ductus.global/t/how-to-make-a-netconf-xml-request-which-can-fetch-all-rows-in-a-list/2253/3 "2019-01-31T20:20:12Z")

</div>

I try what you recommended and it works! Thank you very much.

For the xml rpc like you posted, any idea what the key path will looks like ?  
E.g., I can only figure out the key path with the key value like  
/listener-state[listener-name=‘first’]/listener-name

Thanks!

---

<div class="post-metadata">

**Author:** ![mvf](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mvf/32/182_2.png) [@mvf](https://dmap-community.ductus.global/u/mvf)\
**Post date:** [February 1, 2019, 11:32am UTC](https://dmap-community.ductus.global/t/how-to-make-a-netconf-xml-request-which-can-fetch-all-rows-in-a-list/2253/4 "2019-02-01T11:32:37Z")

</div>

Not sure what you mean by the term “key path”. What you wrote looks like an instance identifier or a XPath expression; if you want an instance identifier, it needs to look exactly like this, if it is an XPath, you can simply omit the predicate (the `[...]` part). ConfD NETCONF agent supports full XPath filtering, so you can use

```auto
 <nc:filter type="xpath" select="/listener-state/listener-name"/>

```

The term keypath is used for something little bit different in the context of ConfD APIs; and as with instance identifiers, you need to provide key values there. See more details on keypaths in ConfD documentation, chapter CDB.

---

<div class="post-metadata">

**Author:** ![buddha87](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@buddha87](https://dmap-community.ductus.global/u/buddha87)\
**Post date:** [February 1, 2019, 6:43pm UTC](https://dmap-community.ductus.global/t/how-to-make-a-netconf-xml-request-which-can-fetch-all-rows-in-a-list/2253/5 "2019-02-01T18:43:18Z")

</div>

Ok, thanks. Yeah, Xpath is what I need.
