Filter parameter specification
filter
parameter allows for scoping down queries. It consists of nodes which are used to build tree-like structure and generate correct SQL queries over underlying databases."type"
key which determines logic that needs to be applied.Example
{
"type" => "and",
"operations" => [
{ "type" => "equal", "field" => "grouping_type", "value" => "optin_channel" },
{ "type" => "equal", "field" => "grouping_value", "value" => "default" }
]
}
filter
parameter to a query will scope it down to records/timeseries data which have both:grouping_type
field with optin_channel
value andgrouping_value
field with default
valueLogical node
"type"
- logical node type (see below)"operations"
- array with underlying nodes"type" key | Operation logic |
---|---|
and | Joins operations with AND |
or | Joins operations with OR |
Rate limiting
1
token to request cost.Base operation node
"type"
- operation node type (see below)"field"
- field which will be used for operation. Note that this field must be "filterable" for given report."value"
- value which will be used in operation"type" key | Operation logic | Requirements | Additional notes |
---|---|---|---|
equal | Checks whether field equals to value | - | When null is provided as a value then IS NULL query will be executed |
not_equal | Checks whether field is not equal to value | - | When null is provided as a value then IS NOT NULL query will be executed |
greated_than | Checks whether field is greater than value | Field must be numerical or timestamp. | - |
greater_or_equal_to | Checks whether field is greater or equal to value | Field must be numerical or timestamp. | - |
less_than | Checks whether field is less than value | Field must be numerical or timestamp. | - |
less_or_equal_to | Checks whether field is less or equal to value | Field must be numerical or timestamp. | - |
in | Checks whether field equals to one of provided values | Value must be an array | When field is an array, then it will be returned when any elements are in common |
not_in | Checks whether field not equals to one of provided values | Value must be an array | Logical opposite of in |
Rate limiting
1
token to request cost.JSON operations node
"type"
- JSON operation node type (see below)"field"
- field which will be used for operation. It needs to be formatted as <report field>.<json_key>
(for example consents.sms_consent
). Note that <report's field>
must be filterable."value"
- value which will be used in operation"type" key | Operation logic | Requirements | Additional notes |
---|---|---|---|
exists | Checks whether JSON key exists | - | - |
not_exists | Checks whether JSON key does not exist | - | - |
equal | Checks whether JSON key value is equal to value | - | - |
not_equal | Checks whether JSON key value is not equal to value | - | - |
Rate limiting
2
tokens to request cost.Location operation node
within_radius
operation. JSON object needs to include:"type"
- within_radius
"latitude_field"
- name of decimal field with latitude"longitude_field"
- name of decimal field with longitude"value"
- JSON object with:"latitude"
- latitude of center of the radius circle"longitude"
- longitude of center of the radius circle"radius"
- size of radius in meters, default: 10000
Rate limiting
5
tokens to request cost.Examples
{
"type": "and",
"operations": [
{ "type": "equal", "field": "grouping_type", "value": "optin_channel" },
{ "type": "equal", "field": "grouping_value", "value": "default" },
{ "type": "within_radius", "latitude_field": "location_latitude", "longitude_field": "location_longitude", "value": { "latitude": 50.049683, "longitude": 19.944544 }
]
}
and
logical node) + 2x1 (equal
operation nodes) + 5 (location node) = 8
tokens to rate limit cost.