Criteria
Overview
The Criteria object is a commonly used model within the Clear API for defining complex filter rules. It is used when generating reports as well as searching across various resources.
A criteria is a recursively nested JSON object composed of branches of conditions, it takes the following base form:
The root key of a Criteria object is known as a Comparator, and the value will always be an Array of values to compare. This object is known as an Operation, and the power of the Criteria object comes in its ability to combine multiple operations together.
At its most simplest, a criteria could simply be matching on a single field:
When used in Actor search, the above criteria will return all actors with a Country
attribute matching Australia
.
However, more advanced examples permit deep nesting to build infinitely complex filter rules:
When used in Actor search, the above criteria will return all actors who meet the following conditions:
The actor must contain a
Country
attribute ofAustralia
, AND;The actor must match any of the following:
The actor must contain a
Department
attribute ofMarketing
, OR;The actor must not contain a
Job Title
attribute ending inManager
Reference
Comparators
Values
Last updated