Creating filters
The acceptable values that govern data filtering are listed in the filters
parameter of the GET/resources operation. SQL statements are applied to values.
Restrictions apply to the use of SQL statements. These restrictions apply to the data types used in the values:
"=" operator (equal to)
Used for arrays and scalar values.
Operator value
Generates the request result for the specified parameter value.
Types of parameters accepted by the operator:
-
boolean
-
contractnumber
-
dictionary
-
domain_mirror
-
login
-
multistate
-
number
-
publicid
-
straight_number
-
text
-
tree
Usage example
Output the RTB blocks that have the «Active» status:
filter=["multistate","=","working"]
where multistate
is the parameter name, working
is the ID of the parameter value.
"<>" operator (not equal to)
Used for arrays and scalar values.
Operator value
The specified parameter value is excluded from the request result.
Types of parameters accepted by the operator:
-
dictionary
-
domain_mirror
-
login
-
multistate
-
number
-
publicid
-
straight_number
-
text
-
tree
Usage example
Output all RTB blocks except the ones with the «Active» status:
filter=["multistate","<>","working"]
where multistate
is the parameter name, working
is the ID of the parameter value.
"IN" operator (matching a list)
Used for arrays and scalar values.
Operator value
Generates the request result for the specified parameter values.
Types of parameters accepted by the operator:
-
contractnumber
-
domain_mirror
-
login
-
number
-
publicid
-
straight_number
-
text
Usage example
Filter the data based on the page_id
of the listed content sites:
filter=["page_id","IN",["41443","42630"]]
where page_id
is the parameter name and 41443, 42630
is the parameter value.
">" operator (greater than)
Used for scalar values.
Operator value
Generates the request result for the parameter values exceeding the specified value.
Types of parameters accepted by the operator:
-
number
-
straight_number
Usage example
Filter the data by page_id
of the content sites that exceed the specified value:
filter=["page_id",">","53100"]
where page_id
is the parameter name and 53100
is the parameter value.
"<" operator (less than)
Used for scalar values.
Operator value
Generates the request result for the parameter values that are less than the specified value.
Types of parameters accepted by the operator:
-
number
-
straight_number
Usage example
Filter the data by page_id
of the content sites that are less than the specified value:
filter=["page_id","<","53100"]
where page_id
is the parameter name and 53100
is the parameter value.
">=" operator (greater than or equal to)
Used for scalar values.
Operator value
Generates the request result for the parameter values that are greater than or equal to the specified value.
Types of parameters accepted by the operator:
-
number
-
straight_number
Usage example
Filter the data by page_id
of the content sites that are greater than or equal to the specified value:
filter=["page_id",">=","53100"]
where page_id
is the parameter name and 53100
is the parameter value.
"<=" (less than or equal to)
Used for scalar values.
Operator value
Generates the request result for the parameter values that are less than or equal to the specified value.
Types of parameters accepted by the operator:
-
number
-
straight_number
Usage example
Filter the data by page_id
of the content sites that are less than or equal to the specified value:
filter=["page_id","<=","53100"]
where page_id
is the parameter name and 53100
is the parameter value.
"NOT IN" operator (not matching a list)
Used for arrays and scalar values.
Operator value
Generates the request result for the parameter values that are not in the specified list.
Types of parameters accepted by the operator:
-
domain_mirror
-
login
-
number
-
publicid
-
straight_number
-
text
Usage example
Filter the data based on the page_id
of the content sites that are not in the list:
filter=["page_id","NOT IN",["53100","53101"]]
where page_id
is the parameter name and 53100, 53101
are the parameter values.
The "IKE" operator (matches the specified substring)
Operator value
Generates the request result for the parameter values that include the specified substring.
Types of parameters accepted by the operator:
-
domain_mirror
-
login
-
text
Usage example
Filter the data by a site name that includes the specified substring:
filter=["domain","LIKE","aliexpress"]
where domain
is the parameter name and aliexpress
is the parameter value. This statement is equivalent to domain LIKE '%aliexpress%'
in SQL.
The "NOT LIKE" operator (does not match the specified substring)
Used for scalar values.
Operator value
Generates the request result for the parameter values that don't include the specified substring.
Parameter types accepted by the operator:
-
domain_mirror
-
login
-
text
Usage example
Filter the data by a site name that doesn't include the specified substring:
filter=["domain","NOT LIKE","aliexpress"]
where domain
is the parameter name and aliexpress
is the parameter value.
"AND" operator
Operator value
Used for combining filters.
Usage example
Filter the data both by the site name and page_id
of a content site. You have two filters:
filter=["domain","=","aliexpress"]
filter=["page_id","=","53100"]
Combine two filters into one:
filter=["AND",[["domain","=","aliexpress"],["page_id","=","53100"]]]
"OR" operator
Operator value
Used for matching at least one of the listed filters.
Usage example
Filter the data either by the site name or page_id
of a content site. You have two filters:
filter=["domain","=","aliexpress"]
filter=["page_id","=","53100"]
Combine two filters into one:
filter=["OR",[["domain","=","aliexpress"],["page_id","=","53100"]]]