1
votes

I am using the google-api-ruby-client v0.7.1, ruby 2.1.

When I upload Custom Data Sources through Google Analytics API v3 with Google Analytics API v3 > analytics.management.dailyUploads.upload :

Request

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

Response

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/..."
          }

    }

That response I get when call this method of api from gem google-api-ruby-client too.

But the documentation states:

HTTP request

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

But in Google APIs Explorer and gem request is https: //www.googleapis.com/analytics/v3... , not https://www.googleapis.com/upload/analytics/v3... .

Anyone encountered this problem and how to fix it?

1

1 Answers

0
votes

You need to change user and code value In authorize method.

You'll get, user_ID from client_secret.json and run the URL, you get in the console under 'Open the following URL in the browser' for code value