Google Analytics dailyUploads无法使用google-api-ruby-client

时间:2014-05-08 11:43:14

标签: ruby google-analytics google-api google-analytics-api google-api-ruby-client

我正在使用google-api-ruby-client v0.7.1,ruby 2.1。

当我使用 Google Analytics API v3 > analytics.management.dailyUploads.upload通过Google AnalyticsAPI v3上传自定义数据源时:

请求

POST https: //www.googleapis.com/analytics/v3/management/accounts/**********************/webproperties/**********************/customDataSources/**********************/dailyUploads/2014-04-06/uploads?appendNumber=1&type=cost&key={YOUR_API_KEY}

Authorization:  Bearer **************************
X-JavaScript-User-Agent:  Google APIs Explorer

响应

400 Bad Request

    {

"error": {

         "errors": [{"domain": "global",
                     "reason": "badRequest",
                     "message": "Upload request url should start with https://www.googleapis.com/upload/analytics/..."}],
          "code": 400,
          "message": "Upload request url should start with https://www.googleapis.com/upload/analytics/..."
          }

    }

从gem google-api-ruby-client调用api的这种方法时我得到的响应。

但是documentation州:

HTTP请求

POST https: //www.googleapis.com/upload/analytics/v3/management/accounts...

但在Google APIs Explorer中,gem请求为https: //www.googleapis.com/analytics/v3 ...,而不是https://www.googleapis.com/upload/analytics/v3... .

任何人遇到此问题以及如何解决此问题?

1 个答案:

答案 0 :(得分:0)

你需要改变      用户和代码值 在授权方法。

你会得到的,      来自client_secret.json的user_ID 和       运行网址,您将进入控制台,在浏览器中打开以下网址'代码值