I want to access value of leaf of list in yang module? Ex
module abc
{
list xyz{
key a;
leaf a{
type int
},
leaf b{
type string
},
leaf c{
type string
},
leaf d{
type string
}
}
}
REST should be like "abc/xyz/(which is key)" i.e. (abc/xyz/1)
it will give all values of a,b,c,d.
But if I want to access of individual element b,c,d individual which is non key. How can we write REST API?
This is explained in RFC8040, Section 3.5.3. Here's the example from this section:
So in the context of your example, you would do
/restconf/data/abc:xyz=my-key/b
,/restconf/data/abc:xyz=my-key/c
or/restconf/data/abc:xyz=my-key/d
, where my-key is the key of the list instance's entry you wish to query.