Filtering data
The allowed values for filtering data are listed in the filters parameter for the GET/resources operation. SQL operators can be applied to the values.
There are restrictions on using SQL operators. These restrictions are related to the data types that are used in values:
"=" operator (equal to)
Used for arrays and scalar values.
Operator value
Results match 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
You need to get RTB blocks that have the “Working” status:
filter=["multistate","=","working"]
where multistate is the parameter name and working is the ID of the parameter value.
"<>" operator (not equal to)
Used for arrays and scalar values.
Operator value
The result excludes the specified parameter value.
Types of parameters accepted by the operator:
-
dictionary -
domain_mirror -
login -
multistate -
number -
publicid -
straight_number -
text -
tree
Usage example
You need to get all the RTB blocks except those blocks that have the “Working” status:
filter=["multistate","<>","working"]
where multistate is the parameter name and working is the ID of the parameter value.
IN (included in)
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
You need to filter data by the website page_ids that are included in a set list:
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
You need to filter data by the website page_ids that are greater than the set 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
You need to filter data by the website page_ids that are less than the set 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
You need to filter data by the website page_ids that are greater than or equal to the set 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
You need to filter data by the website page_ids that are less than or equal to the set value:
filter=["page_id","<=","53100"]
where page_id is the parameter name and 53100 is the parameter value.
"NOT IN" operator (not included in)
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
You need to filter data by the website page_ids that are not included in a set list:
filter=["page_id","NOT IN",["53100","53101"]]
where page_id is the parameter name and 53100, 53101 are the parameter values.
"LIKE" operator (included in 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
You need to filter data by the name of a site that is included in the specified value:
filter=["domain","LIKE","aliexpress"]
where domain is the parameter name, and aliexpress is the parameter value. The current record is equivalent to the domain LIKE '%aliexpress%' record in SQL.
NOT LIKE (not included in 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
You need to filter data by a website name that is not included in the set value:
filter=["domain","NOT LIKE","aliexpress"]
where domain is the parameter name, and aliexpress is the parameter value.
"AND" operator (and)
Operator value
Used for combining filters.
Usage example
You need to filter data by the site name and page_id. You have two filters:
filter=["domain","=","aliexpress"]
filter=["page_id","=","53100"]
You combine the two filters into one:
filter=["AND",[["domain","=","aliexpress"],["page_id","=","53100"]]]
"OR" (logical or)
Operator value
Used for performing at least one of the listed filters.
Usage example
You need to filter data either by the website name or the page_id. You have two filters:
filter=["domain","=","aliexpress"]
filter=["page_id","=","53100"]
You combine the two filters into one:
filter=["OR",[["domain","=","aliexpress"],["page_id","=","53100"]]]