Conditional Operators
Conditional operators can be used to narrow down the result set when querying the /report/{group} API.
All values passed in the optional filters must be URL encoded (/api
|
Operator Notation |
Description |
Example |
|
$eq |
Exact (equal to) |
?query={"accountID" : {"$eq" : "101202692754"}} |
|
$ne |
Not equal to |
?query={"accountID" : {"$ne" : "101202692754"}} |
|
$sw |
Starts with |
?query={"accountID" : {"$sw" : "1012"}} |
|
$ew |
Ends with |
?query={"accountID" : {"$ew" : "7058"}} |
|
$con |
Contains |
?query={"accountID" : {"$con" : "2692"}} |
|
$in |
Multiple values |
?query={"accountID" : {"$in" : ["101202692754", "101098417058"]}} |
|
$nin |
Exclude multiple values |
?query={"accountID" : {"$nin" : ["101202692754", "101098417058"]}} |
|
$gt |
Greater than |
?query={"accountID" : {"$gt" : 101202692754}} |
|
$gte |
Greater than or equal to |
?query={"accountID" : {"$gte" : 101202692754}} |
|
$lt |
Lesser than |
?query={"accountID" : {"$lt" : 101202692754}} |
|
$lte |
Lesser than or equals to |
?query={"accountID" : {"$lte" : 101202692754}} |
|
$btw |
Between (inclusive of both bounds) |
?query={"lastUpdated" : {"$btw" : [“2025-03-31 08:50:54.783“,”2025-04-01 08:50:54.783”]}} |
|
$and |
Joins query clauses with a logical AND returns all records that match the conditions of both clauses |
?query={"$and":{ "someAndField1":{"$btw" : [1734954861548,1734954874182]} ,"someAndField2":{"$eq":"89150"} }} |
|
$or |
Joins query clauses with a logical OR returns all records that match the conditions of either clause |
?query={"$or":{ "someOrField1":{"$btw" : [1734954861548,1734954874182]} ,"someOrField2":{"$eq":"89150"} }} |
Usage Example
The following is a usage example of multiple conditional operators.
query={
"someField1":{"$in":["abcde","12345"]}
,"someField2":{"$eq":"xyz"}
,"$and":{
"someAndField1":{"$btw" : [1734954861548,1734954874182]}
,"someAndField2":{"$eq":"89150"}
,"someAndField3":{"$gte":1734954881461}
}
,"$or":{
"someOrField1":{"$eq":"abcde"}
,"someOrField2":{"$eq":"xyz"}
}
}
The above will get translated into an SQL WHERE clause as follows:
WHERE
(someField1 IN('abcde','12345') AND someField2 = 'xyz')
AND
((someAndField1 BETWEEN 1734954861548 AND 1734954874182) AND someAndField2 = '89150' AND someAndField3 >= 1734954881461)
AND
(someOrField1 = 'abcde' OR someOrField2 = 'xyz')
Possible Errors
If the following error is encountered (or similar ones):
{
"executionTime": 0,
"statusCode": 400,
"statusMessage": "The server identified a request with incorrect parameters."
}
... remove all spaces from the query, URL encode it, and try the request again. For example:
{"accountID" : {"$eq" : "Alpha"}}
should become:
{"accountID":{"$eq":"Alpha"}}