Query (Trader API v1)
- 26 Jun 2023
- 2 Minutes to read
- DarkLight
Query (Trader API v1)
- Updated on 26 Jun 2023
- 2 Minutes to read
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Query
The JSON Schema definition for a query is the following:
{
"id": "Query",
"properties": {
"type": {
"type": "string",
"enum": [
"trader_delivery",
"trader_delivery_3p",
"trader_delivery_3p_staq",
"trader_delivery_all",
"trader_delivery_apps",
"trader_delivery_cities",
"trader_delivery_exchange_sites",
"trader_delivery_segment_tags",
"trader_delivery_segments_appnexus",
"trader_delivery_segments_doubleclick",
"trader_delivery_segments_iab",
"trader_delivery_segments_ias",
"trader_delivery_segments_lotame",
"trader_delivery_segments_sizmek",
"trader_delivery_segments_trader",
"trader_delivery_sites",
"trader_delivery_video",
"trader_seller_revenue",
"trader_supply_activity",
"trader_tune_in"
],
"description": "Type of the query to run"
},
"start_date": {
"type": "string",
"description": "Date, in ISO 8601 format, defining the start of the queried date range"
},
"end_date": {
"type": "string",
"description": "Date, in ISO 8601 format, defining the end of the queried date range"
},
"time_zone": {
"type": "string",
"description": "Time zone name, as in the tz database.
e.g. Africa/Abidjan or Europe/Paris."
},
"dimensions": {
"type": "array",
"items": { "type": "string" },
"description": "Dimensions on which the report should pivot,
the possibles values are based on the query type and are defined in a subsequent table"
}
"metrics": {
"type": "array",
"items": { "type": "string" },
"description": "Aggregated metrics for the selected dimensions,
the possibles values are based on the query type and are defined in a subsequent table"
},
"filter": {
"type": "string",
"max": 1048576,
"description": "SQL expression that represents a filter that will be inserted in a WHERE clause.
Atoms should reference dimensions."
},
"metrics_filter": {
"type": "string",
"max": 1048576,
"description": "SQL expression that represents a filter that will be inserted in a HAVING clause.
Atoms should reference metrics."
},
"order_fields": {
"type": "array",
"items": { "type": "string" },
"description": "List of dimensions and metrics to sort by.
If a string is prepended with '-', the sorting order is reversed to descending."
},
"limit": {
"type": "integer",
"description": "Maximum number of elements to be returned"
},
"offset": {
"type": "integer"
"description": "Starting offset of elements to be returned.
This is usually used in conjunction with limit"
},
"calculate_time_period":{
"type":"boolean"
"description": "If set true the start and end dates will be calculated. This works only for Delivery_all and Delivery_3p types only"
},
"show_totals":{
"type":"boolean"
"description": "If set true then the totals are calculated. This is only for query endpoint"
},
"sum": {
"type": "array",
"items": { "type": "string" },
"description": "dimensions and metrics that are to be summed up,
the possibles values are based on the query type and are defined in a subsequent table"
} ,
"avg": {
"type": "array",
"items": { "type": "string" },
"description": "dimensions and metrics that are to be averaged,
the possibles values are based on the query type and are defined in a subsequent table"
},
"max": {
"type": "array",
"items": { "type": "string" },
"description": "dimensions and metrics for maximum need to calculated,
the possibles values are based on the query type and are defined in a subsequent table"
},
"min": {
"type": "array",
"items": { "type": "string" },
"description": "dimensions and metrics for minimum need to calculated,
the possibles values are based on the query type and are defined in a subsequent table"
}
},
"required": [ "type", "start_date", "end_date", "dimensions", "metrics" ]
}
Was this article helpful?