google-apigoogle-api-clientdouble-click-advertising

Google DoubleClick Bid Manager API create query


I am trying to create a query using google doubleclick bid manager API (version 1). My request is

POST https://www.googleapis.com/doubleclickbidmanager/v1/query?fields=metadata(dataRange%2CgoogleDrivePathForLatestReport)%2Cparams(filters%2CgroupBys)%2CqueryId&key={YOUR_API_KEY}

{
 "kind": "doubleclickbidmanager#query",
 "params": {
  "metrics": [
   "METRIC_BILLABLE_COST_ADVERTISER",
   "METRIC_IMPRESSIONS"
  ],
  "type": "TYPE_GENERAL",
  "filters": [
   {
    "type": "FILTER_LINE_ITEM_TYPE",
    "value": "RTB_VIDEO"
   }
  ]
 },
 "metadata": {
  "dataRange": "MONTH_TO_DATE",
  "format": "CSV"
 },
 "schedule": {
  "frequency": "ONE_TIME"
 }
}

I get the following error.

cache-control:  private, max-age=0
content-encoding:  gzip
content-length:  122
content-type:  application/json; charset=UTF-8
date:  Tue, 17 Jan 2017 12:16:07 GMT
expires:  Tue, 17 Jan 2017 12:16:07 GMT
server:  GSE
vary:  Origin, X-Origin

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "backendError",
    "message": "Backend Error"
   }
  ],
  "code": 500,
  "message": "Backend Error"
 }
}

What is causing the error? Is the only way to access DBM reports by scheduling them to run and create reports in Google Cloud?


Solution

  • The error disappeared when I passed a dummy queryID. Here is a request that worked.

    {
     "kind": "doubleclickbidmanager#query",
     "metadata": {
      "dataRange": "MONTH_TO_DATE",
      "format": "CSV",
      "title": "test"
     },
     "params": {
      "filters": [
       {
        "type": "FILTER_PARTNER",
        "value": "xxxx"
       }
      ],
      "metrics": [
       "METRIC_IMPRESSIONS"
      ],
      "type": "TYPE_GENERAL"
     },
     "schedule": {
      "frequency": "ONE_TIME"
     },
     "queryId": "1232456"
    }