NX-API REST supports a wide range of flexible filters which are useful for narrowing the scope of a search, allowing information to be located quickly. The filters themselves are appended as query URI options starting with a question mark (?) and concatenated with an ampersand (&). Multiple conditions can be joined together to form complex filters.

The Cisco NX-API REST API User Guide discusses in detail how to use filters and filter syntax while providing examples. Using some of the tools discussed in the following sections, you can build your own query strings and discover those being used by the native Cisco NX-API REST interface.

Tree-Level Queries

The following figure shows a switch chassis that is queried at the tree level.

Tree-Level Queries

Tree-Level Queries

Class-Level Queries

The following figure shows the second query type: the class-level query.

Class-Level Queries

Class-Level Queries

Class-level queries return all objects of a given class. This approach is useful for discovering all the objects of a certain type that are available in the MIT. In this example, the class used is Cards which returns all objects of type Cards.

Object-Level Queries

The third query type is an object-level query. In an object-level query, a distinguished name is used to return a specific object.

Object-Level Queries

Object-Level Queries

For all MIT queries, an administrator can optionally return the entire subtree or a partial subtree. Additionally, the role-based access control (RBAC) mechanism in the system dictates which objects are returned; only the objects that the user has rights to view will be returned.