Cisco Cisco Evolved Programmable Network Manager 2.0 Developer's Guide
Filtering
Cisco Evolved Programmable Network Manager 2.0 RESTCONF NBI Guide
82
82
8 Filtering
Filtering lets you limit the results of a request based on the value of specific Resource
attributes. Filtering is supported for all request types
attributes. Filtering is supported for all request types
Filtering Syntax
Filtering on a given attribute of a resource is simple. The documentation gives a list of all
attributes for a given resource. For example, to get a device with a given name, you may
use the following:
attributes for a given resource. For example, to get a device with a given name, you may
use the following:
https://<server_name>/restconf/data/v1/epnm-restconf-xmp-im-ext-
managedelement:ManagedElement?name=ASR9K
managedelement:ManagedElement?name=ASR9K
A set of operators allows you to refine the filter in many ways. For example, to get the
list of all devices that start with a pattern, you may use wildcards on the <name>:
list of all devices that start with a pattern, you may use wildcards on the <name>:
https://<server_name>/restconf/data/v1/epnm-restconf-xmp-im-ext-
managedelement:ManagedElement?name=ASR*
managedelement:ManagedElement?name=ASR*
The results of a query can be filtered using the value of one or a combination of multiple
attributes.
attributes.
https://<server_name>/restconf/data/v1/epnm-restconf-xmp-im-ext-
managedelement:ManagedElement?name=ASR*&communicationState=REACHABLE
managedelement:ManagedElement?name=ASR*&communicationState=REACHABLE
URL encoding
When forming a filter URL it must comply with URL encoding rules and only contain
characters from the ASCII character-set.
Filter values may frequently contain characters from outside the ASCII set, e.g. space:
characters from the ASCII character-set.
Filter values may frequently contain characters from outside the ASCII set, e.g. space:
https://<server_name>/restconf/data/v1/epnm-restconf-xmp-im-ext-
managedelement:ManagedElement?description=sample description
managedelement:ManagedElement?description=sample description
These must be converted into a valid ASCII format. URL encoding replaces unsafe ASCII
characters with a "%" followed by two hexadecimal digits.
A web browser will automatically encode the entered URL before sending it. However, if
for example you are using a client coded with cURL you will need to do the encoding
yourself. For example space character should be encoded as "%20".
characters with a "%" followed by two hexadecimal digits.
A web browser will automatically encode the entered URL before sending it. However, if
for example you are using a client coded with cURL you will need to do the encoding
yourself. For example space character should be encoded as "%20".
Advanced Filtering
Advanced filtering can be applied to attributes if the criteria conforms to the following
table. The first two rows show how to control how the filter combines multiple criteria
parameters (separated the ampersand ‘&’ as usual). The “and” (conjunction) and “or”
(disjunction) operators are supported, although it is not necessary to use “or” since it is
the default. Note that “and” and “or” cannot combined: the selected operator applies to
all the criteria.
table. The first two rows show how to control how the filter combines multiple criteria
parameters (separated the ampersand ‘&’ as usual). The “and” (conjunction) and “or”
(disjunction) operators are supported, although it is not necessary to use “or” since it is
the default. Note that “and” and “or” cannot combined: the selected operator applies to
all the criteria.