Page tree


The filters query string parameter restricts the data returned from your request. To use the filters parameter, supply a dimension or metric on which to filter, followed by the filter expression.

 


Example:

The following query requests paidImpressions greater than 10000 served by a category equal to 123.

	&filters=paidImpressions gt 10000&filters=categoryId eq 123

 


You must include URL encoding in URL parameters. For example, Filter  with a trailing space should be encoded as Filter%20.


 

Filter Syntax

A single filter uses the following syntax:

 

  • <name> - Indicates the name of the dimension or metric on which to filter, such as campaignId filters on the paidImpressions metric.
  • <operator> - Indicates the type of filter match to use; specific to either dimensions or metrics.
  • <value> - Indicates the values to be included in or excluded from the results.

 

Note:

  • There should be a space between <name>,<operator> and <value>.
  • Single filters should contain either a dimension or metric.
  • <Operator> syntax is not case sensitive. For example, noteq and NOTEQ are treated the same.
  • For null value filters only, NOTEQ and EQ operators are applicable. For example: &filters=adNetworkVariantId notEq null

Filter Types                                

  • AND filtering:  To include required multiple values in a request, prefix the conditions with an ampersand ("and").


Example:

&filters=siteId EQ 36321&filters=countryId EQ 232 is interpreted as siteId = 36321 and countryId = 232

 

  • OR filtering: To indicate optional multiple values in a request, separate the conditions with commas ("or").


Example: 

&filters=siteId EQ 36321,siteId EQ 36435 is interpreted as (siteId = 36321 OR siteId = 36435)

 

Limitations:

  • You may include 'OR' within dimensions or within metrics but not within dimensions and metrics together. For example, for dimensions D1 and D2 and metrics M1 and M2:
            Valid:      (D1 = 1 or D2 = 2) and (M1 > 100 or M2 > 1000)
            Invalid:   (D1 = 2 or M1 > 100)
  • You may use 'OR' between 'AND' but not 'AND' between 'OR.' For example:
            Valid:      (D1 = 1 or D2 = 2) and (M1 > 100 or M2 > 1000)
            Invalid:   (D1 = 1 and D2 = 2) or (M1 > 100 and M2 > 1000)