Filter
Filters enable you to prune the results of an API call based on the conditions specified. The filters are passed as parameters in an API call. The filter is in the JSON format.
Attribute | Data Type | Description |
---|---|---|
property | String | Specifies the attribute of the response JSON for an API call that must be used to filter the results. Refer respective API call to see possible property values. |
value | Array | Is an array of object. The operator will be applicable to all values in an array. Implicitly OR operation will be performed on multiple values specified in the array. |
operator | String | is used to specify the condition on which filtering is to be done. The below table contains few operators used depending on the data type of property. |
Operators | String | Integer | Long | Boolean | Enum |
---|---|---|---|---|---|
= (Equals) | Yes | Yes | Yes | Yes | Yes |
< (Less than) | No | Yes | Yes | No | No |
> (Greater than) | No | Yes | Yes | No | No |
<= (Less than equal to) | No | Yes | Yes | No | No |
>= (Greater than equal to) | No | Yes | Yes | No | No |
Contains (String Contains) | Yes | No | No | No | No |
notcontains (String does not contains) | Yes | No | No | No | No |
!= (Not equal to) | Yes | Yes | Yes | Yes | Yes |
OR (OR multiple filter conditions) | No | No | No | No | No |
bitwise_and (Bitwise And for multiple filter conditions) | No | No | No | No | No |
Sample Filter
The below filter will provide the details of those APs, that are connected to SSID with name InternetDetection2aps1.
filter= { "property": "ssid", "value": ["InternetDetection2aps1"], "operator": "contains" }
Combining Filters
Filters are combined using a query parameter operator.
Operator: It is an optional query parameter that performs logical operations on filters. Possible values are AND and OR. The default value is AND.
OR Operator
While combining two or more filters using OR, any one of the filters should stand true.
For Example:
In the below example there are three filters say A and . They are combined using OR operator as (A OR B)
filter= { "property": "channel", "value": [1], "operator": "=" } & filter= { "property": "ssid", "value": ["InternetDetection2aps1"], "operator": "contains" } & operator=OR
AND Operator
While combining two or more filters using AND, all the filter must stand true.
For Example:
In the below example there are three filters say A and . They are combined using AND operator as (A AND B)
filter= { "property": null, "value": [ { "property": "ssid", "value": ["InternetDetection2aps1"], "operator": "contains" }, { "property": "channel", "value": [1], "operator": "=" } ], "operator": "AND" }
Combining AND and OR Operators
It is possible to combine filters with the combination of AND and OR operators.
Example – 1:
In the below example there are three filters say A, B and C. They are combined using AND and OR operators as (A AND (B OR C))
filter= { "property": "devicename", "value": ["Motorola-Mobility_02:3A:DA"], "operator": "contains" } & filter= { "property": null, "value": [ { "property": "ssid", "value": ["moto"], "operator": "contains" }, { "property": "channel", "value": [1], "operator": "=" } ], "operator": "OR" }
Example – 2: In the below example there are four filters say A, B, C and D. They are combined using AND and OR operators as (A OR B) AND (C OR D)
filter= { "property": null, "value": [ { "property": "devicename", "value": ["Mojo_DC:56:60"], "operator": "=" }, { "property": "channel", "value": [1], "operator": "=" } ], "operator": "OR" } & filter= { "property": null, "value": [ { "property": "ssid", "value": ["InternetDetection2aps1"], "operator": "contains" }, { "property": "macaddress", "value": ["00:11:74:DC:56:60"], "operator": "contains" } ], "operator": "OR" } &operator=AND
Note
- Operator will be validated according to property.
For eg –
-
- Mac address cannot be compared with <=, >,etc.
- “like” and “contains” can be applied only to String values.
- “<”, “>”, “>=”, “<=” operators cannot be applied to String values.
- Depending on operator, values passed in array are validated