创建新查询DoubleClick Bid Manager时出现问题

时间:2017-06-14 08:28:39

标签: java google-apis-explorer

我正在尝试在Doubleclick Bid Manager中创建一个新查询,但我得到的只是“500内部服务器错误”(https://developers.google.com/bid-manager/v1/queries/createquery)。

QueryMetadata metadata = new QueryMetadata();
String tiempo = "LAST_14_DAYS";
metadata.setTitle("June");
metadata.setFormat("CSV");
metadata.setDataRange("PREVIOUS_WEEK");

Query queryTest = new Query();
queryTest.setMetadata(metadata);

Query tres = service.queries().createquery(queryTest).execute();

有人可以帮我查询请求查询吗?谢谢!

1 个答案:

答案 0 :(得分:0)

以下代码有效。

代码请求:

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"
      }
    ]
  }
}