filter

The filter query parameter

The filter query parameter is used to specify a response with certain data fields.

Using the filter reduces the response data by only returning the filtered results.

You must use JSONPath with the filter query parameter. More information on JSONPath can be found at https://goessner.net/articles/JsonPath/ and https://jsonpath.com/.

Sample request from client to filter for all interface names - ports and VLANs

GET /rest/restconf/data/openconfig-interfaces:interfaces?formatted=True&filter=$.'openconfig-interfaces:interfaces'.interface[*].name
HTTP/1.1
Host: 10.68.5.80

Sample response data from server

[
"1",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"2",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"3",
"30",
"31",
"32",
"33",
"34",
"4",
"5",
"6",
"7",
"8",
"9",
"Default",
"TestVlan1234",
"interdut",
"testbfdlpbk",
"testbfdlpbk2",
"testbfdvlan",
]

Sample request to filter for only port interface names

GET /rest/restconf/data/openconfig-interfaces:interfaces?formatted=True&$.'openconfig-interfaces:interfaces'.interface[?(@.state.type=='ethernetCsmacd')].name
HTTP/1.1
Host: 10.68.5.80

Sample response data from server

[
"1",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"2",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"3",
"30",
"31",
"32",
"33",
"34",
"4",
"5",
"6",
"7",
"8",
"9"
]