NOTE: Trivore ID Documentation has moved to https://trivoreid.com
The content on this site IS OUT OF DATE!
This space has been archived!
Please go ahead to the new site!
Filter (python)
For more information see Filtering.
Helper to generate filter parameter. Used to query service models. The models and their fields can be found on the services page
from trivoreid.utils.criteria import Filter # query attributes that contain 'value' myFilter = Filter(Filter.CONTAINS, 'attribute', 'value') # combine two filters (Filter1 AND Filter2) myFilter = Filter().and_filters(Filter(Filter.LESS_THAN, 'attribute2', 3), Filter(Filter.ENDS_WITH, 'attribute3', 'lue')) # combine two filters (Filter1 OR Filter2) myFilter = Filter().or_filters(Filter(Filter.EQUAL, 'attribute4', ), Filter(Filter.GREATER_OR_EQUAL_THAN, 'attribute5', 50))
DateTime filtering
Filter expressions where the value is a string and can be parsed as an ISO Instant string, are used as DateTime filters. For example:
myFilter = Filter(Filter.GREATER_THAN, 'createdDate', '2017-10-20T07:17:17.606Z') myFilter = Filter(Filter.LESS_THAN, 'lastModifiedDate', '2019-05-31T23:59:59.999Z')
Group membership
Filter expressions for the user's list of groups.
# filter out users that don't belong to any group myFilter = Filter(Filter(Filter.PRESENT, 'memberOf')) # filter users that belong to the group with id 'groupId'. myFilter = Filter(Filter(Filter.CONTAINS, 'memberOf', 'groupId')