Topic
2 replies Latest Post - ‏2013-01-10T16:41:13Z by DGarriott
DGarriott
DGarriott
8 Posts
ACCEPTED ANSWER

Pinned topic Google Analytics

‏2012-12-19T14:17:55Z |
Hi,

I am using Cast Iron to send an HTTP GET request to the Google Analytics API to perform several queries. The problem is when I send my HTTP GET request I receive the following message, "The request operation failed . Exception: Received Http Code:400 from www.googleapis.com." The 400 error code indicates there is something in the query string that is not correct. Here is a sample of my query string, https://www.googleapis.com/analytics/v3/data/ga? and also utilizing the following URI, ids=ga%3AXXXXXXX&dimensions=ga%3AvisitorType%2Cga%3AvisitCount%2Cga%3AdaysSinceLastVisit%2Cga%3AuserDefinedValue&metrics=ga%3Avisitors&start-date=2012-11-29&end-date=2012-12-13&max-results=10000. I am also providing an authorization token as a header item in my GET request.

To build the query string I used http://ga-dev-tools.appspot.com/explorer/. I have tried using as few as one metric and I also tried switching between tables to see if that made a difference, but I have had no luck in getting my query to work.

Does anyone have experience with the Google Analytics API and know why I would be receiving the 400 error code?

Please let me know if I need to provide any more information.

Thank you!

Danny
Updated on 2013-01-10T16:41:13Z at 2013-01-10T16:41:13Z by DGarriott
  • SystemAdmin
    SystemAdmin
    1250 Posts
    ACCEPTED ANSWER

    Re: Google Analytics

    ‏2013-01-09T15:16:57Z  in response to DGarriott
    Are you sending the encoded string as shown (e.g., %3A instead of :)? If so, did you try sending in unencoded.
    • DGarriott
      DGarriott
      8 Posts
      ACCEPTED ANSWER

      Re: Google Analytics

      ‏2013-01-10T16:41:13Z  in response to SystemAdmin
      I was sending string encoded as in the example. I tried without encoding the string and it worked perfectly!

      Thank you!
      Danny