# Using Restconf using Confd6.3.1

**URL:** <https://dmap-community.ductus.global/t/using-restconf-using-confd6-3-1/1079>\
**Category:** Other Northbound Interfaces\
**Created:** [March 15, 2017, 9:57am UTC](https://dmap-community.ductus.global/t/using-restconf-using-confd6-3-1/1079 "2017-03-15T09:57:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![viprasad](https://avatars.discourse-cdn.com/v4/letter/v/71e660/32.png) [@viprasad](https://dmap-community.ductus.global/u/viprasad)\
**Post date:** [March 15, 2017, 9:57am UTC](https://dmap-community.ductus.global/t/using-restconf-using-confd6-3-1/1079/1 "2017-03-15T09:57:11Z")

</div>

Hi,

I am using Confd6.3.1 and trying to use restconf on it.  
For this i have enabled the restconf in the confd.conf and i am able to fire the below query to identify the root:-

```
[viprasad@in-mvlb49 ConfdLogs]$ curl -i -u secadmin:Infinera#2 http://10.220.74.53:8008/.well-known/host-meta -H "Accept: application/yang-data+json" -X GET
HTTP/1.1 200 OK
Server: 
Date: Wed, 15 Mar 2017 09:56:00 GMT
Content-Length: 107
Content-Type: application/xrd+xml
Vary: Accept-Encoding

<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
    <Link rel='restconf' href='/restconf'/>
</XRD>
[viprasad@in-mvlb49 ConfdLogs]$ 

```

After this when i fire the below query,it displays only the statictics info .But not the capabilities,schema info ,etc:-

```
[viprasad@in-mvlb49 ConfdLogs]$ curl -i -u secadmin:Infinera#2 http://10.220.74.53:8008/restconf/data -H "Accept: application/yang-data+json" -X GET
HTTP/1.1 200 OK
Server: 
Date: Wed, 15 Mar 2017 09:56:33 GMT
Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
Content-Type: application/yang-data+json
Transfer-Encoding: chunked
Pragma: no-cache

{
  "ietf-netconf-monitoring:netconf-state": {
    "statistics": {
      "in-bad-hellos": 0,
      "in-sessions": 0,
      "dropped-sessions": 0,
      "in-rpcs": 0,
      "in-bad-rpcs": 0,
      "out-rpc-errors": 0,
      "out-notifications": 0
    }
  }
}

```

Can anyone please help me what i might be missing here …

Thanks,  
Vivek Prasad

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [March 15, 2017, 6:37pm UTC](https://dmap-community.ductus.global/t/using-restconf-using-confd6-3-1/1079/2 "2017-03-15T18:37:37Z")

</div>

Hi Vivek,

Does your user have access rights to view the data?

Example for reference (admin user - see aaa\_init.xml):

```
$ pwd
/home/tailf/confd-6.3.1/examples.confd/rest/router
$ diff ./confd.conf /home/tailf/confd-6.3.1/examples.confd/rest/router/confd.conf
266,272d265
< <restconf>
< <enabled>true</enabled>
< <!--
< The RESTCONF root resource is the first part of the RESTCONF API path.
< -->
< <rootResource>restconf</rootResource>
< </restconf>
$ curl -i -u admin:admin http://127.0.0.1:8008/restconf/data/restconf-state -H "Accept: application/yang-data+json" -X GET
HTTP/1.1 200 OK
Server: 
Date: Wed, 15 Mar 2017 18:29:32 GMT
Last-Modified: Fri, 01 Jan 1971 00:00:00 GMT
Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
Etag: 1489-602043-233942
Content-Type: application/yang-data+json
Transfer-Encoding: chunked
Pragma: no-cache

{
  "ietf-restconf-monitoring:restconf-state": {
    "capabilities": {
      "capability": ["urn:ietf:params:restconf:capability:defaults:1.0?basic-mode=explicit", "urn:ietf:params:restconf:capability:depth:1.0", "urn:ietf:params:restconf:capability:fields:1.0", "urn:ietf:params:restconf:capability:with-defaults:1.0", "http://tail-f.com/ns/restconf/collection/1.0", "http://tail-f.com/ns/restconf/query-api/1.0"]
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![viprasad](https://avatars.discourse-cdn.com/v4/letter/v/71e660/32.png) [@viprasad](https://dmap-community.ductus.global/u/viprasad)\
**Post date:** [March 16, 2017, 7:28am UTC](https://dmap-community.ductus.global/t/using-restconf-using-confd6-3-1/1079/3 "2017-03-16T07:28:56Z")

</div>

Hi,  
Got the issue .  
Actually there is a defect in Confd6.3.1 if we use candidate database along with running datastore writable which was the case of mine.  
I disabled the candidate database .Now its running fine.  
Thanks,  
Vivek Prasad

---

<div class="post-metadata">

**Author:** ![kanaga](https://avatars.discourse-cdn.com/v4/letter/k/ebca7d/32.png) [@kanaga](https://dmap-community.ductus.global/u/kanaga)\
**Post date:** [November 16, 2021, 6:27pm UTC](https://dmap-community.ductus.global/t/using-restconf-using-confd6-3-1/1079/4 "2021-11-16T18:27:56Z")

</div>

Hi,  
How to retrieve keyless list element via restconf

```auto
 container routes {
            description
              "Current content of the RIB.";
            list route {
              description
                "A RIB route entry. This data node MUST be augmented
                 with information specific for routes of each address
                 family.";
              leaf route-preference {
                type route-preference;
                description
                  "This route attribute, also known as administrative
                   distance, allows for selecting the preferred route
                   among routes with the same destination prefix. A
                   smaller value means a more preferred route.";
              }
              container next-hop {
                description
                  "Route's next-hop attribute.";
                uses next-hop-state-content;
              }
              uses route-metadata;
            }

```

Tried with below and it produces output below

```auto
http://167.254.216.30:33002/restconf/data/ietf-routing:routing-state/routing-instance=default/ribs/rib="ipv4"/routes

<routes xmlns="urn:ietf:params:xml:ns:yang:ietf-routing" xmlns:rt="urn:ietf:params:xml:ns:yang:ietf-routing">
    <route>
        <route-preference>0</route-preference>
        <next-hop>
            <next-hop-address xmlns="urn:fujitsu:params:xml:ns:yang:ietf-ipv4-unicast-routing-ext">0.0.0.0</next-hop-address>
            <outgoing-interface xmlns="urn:fujitsu:params:xml:ns:yang:ietf-routing-ext">ip-1/0/0/E-SC-E1</outgoing-interface>
        </next-hop>
        <source-protocol>direct</source-protocol>
        <active/>
        <last-updated>2021-11-16T12:06:58-06:00</last-updated>
        <destination-prefix xmlns="urn:ietf:params:xml:ns:yang:ietf-ipv4-unicast-routing">6.6.6.6/32</destination-prefix>
    </route>
</route>
</routes>

```

wanted to retrieve route[1]… and couldn’t succeed with below format

```auto
http://167.254.216.30:33002/restconf/data/ietf-routing:routing-state/routing-instance=default/ribs/rib="ipv4"/routes/route="1"

```

can someone help?

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [November 17, 2021, 11:09am UTC](https://dmap-community.ductus.global/t/using-restconf-using-confd6-3-1/1079/5 "2021-11-17T11:09:36Z")

</div>

I don’t know if this works with 6.3 that was released 5 years ago, but with ConfD 7.6 you can use the “limit” and “offset” query parameters.  
Example on how to get the second list-entry in a list:

```auto
Header: application/vnd.yang.collection+xml
Path: http://localhost:8008/restconf/data/ietf-routing:routing-state/routing-instance=default/ribs/rib="ipv4"/routes/route?offset=2&limit=1

```

---

<div class="post-metadata">

**Author:** ![kanaga](https://avatars.discourse-cdn.com/v4/letter/k/ebca7d/32.png) [@kanaga](https://dmap-community.ductus.global/u/kanaga)\
**Post date:** [November 22, 2021, 6:20am UTC](https://dmap-community.ductus.global/t/using-restconf-using-confd6-3-1/1079/6 "2021-11-22T06:20:26Z")

</div>

Hi Cohult  
Your suggestion worked. How to retreive the specific element which comes under that list entries?

for ex: i wanted to retrieve route-preference of all the list entries.

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [November 22, 2021, 9:08am UTC](https://dmap-community.ductus.global/t/using-restconf-using-confd6-3-1/1079/7 "2021-11-22T09:08:30Z")

</div>

> [@kanaga](#):
>
> for ex: i wanted to retrieve route-preference of all the list entries.

Just use the RESTCONF standard “fields” parameter. Example:

```auto
http://localhost:8008/restconf/data/datamodel:routes/route?offset=0&limit=1&fields=route-preference

```

More “fields” parameter examples in the RESTCONF RFC [RFC 8040 - RESTCONF Protocol](https://datatracker.ietf.org/doc/html/rfc8040#appendix-B.3.3)
