Re: Encoding issue when using POST with v3 API

Nick Apr 23, 2012 10:17 AM
Posted in group: google-analytics-data-export-api

Our Core Reporting API is designed to only work with GET so I'm surprised you are making POST requests. It might be that POST is incorrectly encoding utf8 characters?


On Monday, April 23, 2012 9:10:13 AM UTC-7, Eduardo Scoz wrote:
Hi guys,

It seems like I was finally able to understand exactly a problem that is happening to the new v3 API when passing data in the body of a POST request (used by the iOS library). 

Here's the problem: the API cannot understand UTF8 characters passed in filters, like the following request. The data always comes back as empty (no errors).

    "method": "",
    "id": "gtl_17",
    "jsonrpc": "2.0",
    "params": {
        "end-date": "2012-04-22",
        "ids": "ga:MYID",
        "filters": "ga:Region==Baden-Württemberg",
        "metrics": "ga:visits, ga:pageviews, ga:visitBounceRate, ga:pageviewsPerVisit",
        "start-date": "2012-03-23",
        "sort": "-ga:visits",
        "dimensions": "ga:City"
    "apiVersion": "v3"

If I remove the filter, or change it to "ga:Region==Germany" (no utf8 chars), it works correctly. But when I pass the ü it fails. It also fails for names that have commas in them, like the region of "Mariy El, Republic" in Russia. I tried to urlencode the filter to "ga:Region==Baden-W%C3%BCrttemberg", but it doesn't work either.

This works when doing normal GET requests (worked correctly on 

Any ideas? This is causing a lot of frustration for some of the users of my app Quicklytics..


Eduardo Scoz