Topic
  • 3 replies
  • Latest Post - ‏2015-03-11T20:14:01Z by ESBDeveloper
DGarriott
DGarriott
8 Posts

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

    Re: Google Analytics

    ‏2013-01-09T15:16:57Z  
    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

    Re: Google Analytics

    ‏2013-01-10T16:41:13Z  
    Are you sending the encoded string as shown (e.g., %3A instead of :)? If so, did you try sending in unencoded.
    I was sending string encoded as in the example. I tried without encoding the string and it worked perfectly!

    Thank you!
    Danny
  • ESBDeveloper
    ESBDeveloper
    1 Post

    Re: Google Analytics

    ‏2015-03-11T20:14:01Z  
    • DGarriott
    • ‏2013-01-10T16:41:13Z
    I was sending string encoded as in the example. I tried without encoding the string and it worked perfectly!

    Thank you!
    Danny

    Hello Danny,

     

            I know it was while a ago you may worked on this. I am also working on the similar requirement pulling the data from Google analytics. I ama able to get eh token and then when trying to fetch the data it is failing to connect to get http activity and throwing below error. Any idea about the below error. Can you please give mfew details how you are trying to retrieve the data like which activity you are using and what are the high level params etc

     

    "The send request failed. Exception: Error while parsing the host port. Incorrect port number:"

     

    Thanks