As mentioned in the basic reporting section request body can contain various properties, such as query, page, page_size, sort, group_by and data_fields. This will allow you to generate advanced custom reports, suiting your very own business logic.
Body Properties
| Body Property | Description | 
|---|---|
| query | Used to specify filter.  You can find more information in the next paragraph below.  | 
| page  page_size  | 
Used to iterate over the result data set.  The maximum value for page_size is 500.  | 
| group_by | Specifies columns for the aggregation | 
| data_fields | Specifies a list of metrics to return.  See annex for all available metrics  | 
| sort | Used to order your data. It accepts an array of fields.  - Prepend “+” to a field name to request ascending order. - Prepend “-” to a field name to request descending order. By default, descending order is used.  | 
Understanding Filters
A query filter can be complex and combine logical or, and and in operators and different comparison methods.
Comparison Methods
| Field Name | Description | 
|---|---|
| eq | Equals | 
| gt | Greater than | 
| lt | Lower than | 
| gte | Greater or equal | 
| lte | Lower or equal | 
| neq | Not equal | 
| like | Should contain a given substring, also supports % as a wildcard to specify left/right match | 
| notLike | Should not contain a given substring, also supports % to specify left/right match | 
Example Usage for Query Property
curl --request POST \
  --url https://api.yoc.com/api/v1/reporting/publishers \
  --header 'Authorization: Bearer your-access-token' \
  --header 'Content-Type: application/json' \
  --data '{
    "query": {
        "and": [{
	        "gte": {
	            "date": "2021-09-01"
	        }
      	}, {
	        "eq": {
	            "company_id":106
	        }
	    }, {
	        "in": {
	            "site_visx_id": [5067, 6078]
	        }
	    }, {
	    "or": [{
		    "eq": {
		        "ad_unit_visx_id":"191456"
		    }
	    }, {
		    "like": {
		        "ad_unit_name": "center" 
		    }
	    }, {
		    "notLike": {
		        "ad_unit_name": "%_HB" 
		    }
	    }]
	}]}
}'
Combining Body Properties
curl --request POST \
  --url https://api.yoc.com/api/v1/reporting/publishers \
  --header 'Authorization: Bearer your-access-token' \
  --header 'Content-Type: application/json' \
  --data '{
	"query": {
	    "and": [
	        {
		"gte": {
		    "date": "2021-09-01"
		}
 	        }
	    ]
	},
	"page_size": 25,
    "page": 1,
	"sort": [
		"site_name",
		"+views",
		"-impressions"
	],
	"group_by": [
		"site_name"
	],
	"data_fields": [
		"impressions",
		"views",
		"vtr",
		"clicks",
		"ctr",
		"cpm_EUR",
		"billable_events"
	]
}'