HomeGuidesAPI Reference
GuidesAPI ReferenceGitHubAirheads Developer CommunityLog In

REST API filtering

This information is also available in the ClearPass 6.9 Guest documentation available at https://www.arubanetworks.com/techdocs/ClearPass/6.9/Guest/Default.htm under Administration > API Services > REST API_FIltering

DescriptionJSON Filter Syntax
No filter, matches everything{}
Field is equal to "value"{"fieldName":"value"}
OR
{"fieldName":{"$eq":"value"}}
Field is one of a list of values{"fieldName":["value1", "value2"]}
OR
{"fieldName":{"$in":["value1", "value2"]}}
Field is not one of a list of values{"fieldName":{"$nin":["value1", "value2"]}}
Field contains a substring "value"{"fieldName":{"$contains":"value"}}
Field is not equal to "value"{"fieldName":{"$ne":"value"}}
Field is greater than "value"{"fieldName":{"$gt":"value"}}
Field is greater than or equal to "value"{"fieldName":{"$gte":"value"}}
Field is less than "value"{"fieldName":{"$lt":"value"}}
Field is less than or equal to "value"{"fieldName":{"$lte":"value"}}
Field matches a regular expression (case-sensitive){"fieldName":{"$regex":"regex"}}
Field matches a regular expression (case-insensitive){"fieldName":{"$regex":"regex", "$options":"i"}}
Field exists (does not contain a null value){"fieldName":{"$exists":true}}
Field is NULL{"fieldName":{"$exists":false}}
Combining filter expressions with AND{"$and":[ filter1, filter2, ... ]}
Combining filter expressions with OR{"$or":[ filter1, filter2, ... ]}
Inverting a filter expression{"$not":{ filter }}
Field is greater than or equal to 2 and less than 5{"fieldName":{"$gte":2, "$lt":5}}
OR
{"$and":[ {"fieldName":{"$gte":2}}, {"fieldName":{"$lt":5}} ]}

Examples of some commonly used filters:
Retrieve active session for a given username

{
  "filter": {
    "username": "[email protected]",
    "acctstoptime": {"$exists": false}
  }
}