以下代码有效。
代码请求:
QueryMetadata metadata = new QueryMetadata();
String tiempo = "LAST_14_DAYS";
metadata.setTitle("June");
metadata.setFormat("CSV");
metadata.setDataRange("MONTH_TO_DATE");
List<FilterPair> prueba = new ArrayList<>();
FilterPair filter = new FilterPair();
filter.setType("FILTER_ADVERTISER");
prueba.add(filter);
Parameters parameter = new Parameters();
parameter.setType("TYPE_GENERAL");
parameter.setFilters(prueba);
QuerySchedule schedule = new QuerySchedule();
schedule.setFrequency("DAILY");
Query queryTest = new Query();
queryTest.setMetadata(metadata);
queryTest.setParams(parameter);
queryTest.setSchedule(schedule);
Query tres = service.queries().createquery(queryTest).execute();
JSON 正文:
{
"kind": "doubleclickbidmanager#query",
"metadata": {
"dataRange": "MONTH_TO_DATE",
"format": "CSV",
"title": "test"
},
"queryId": "1322322",
"schedule": {
"frequency": "DAILY"
},
"params": {
"metrics": [
"METRIC_IMPRESSIONS",
],
"type": "TYPE_GENERAL",
"filters": [
{
"type": "FILTER_ADVERTISER"
}
]
}
}