Hi all,
I've been working for a while now on trying to download data from the Google Webmaster Tools Search Analytics API but have had no success so far.
I get as far as successfully connect to the API through the following URL (https://www.googleapis.com/webmasters/v3/sites/SITEURL/searchAnalytics/query), but keep on retrieving a parse error:
{¶ ·"error":·{¶ ··"errors":·[¶ ···{¶ ····"domain":·"global",¶ ····"reason":·"parseError",¶ ····"message":·"Parse·Error"¶ ···}¶ ··],¶ ··"code":·400,¶ ··"message":·"Parse·Error"¶ ·}¶ }¶
The query originally uses POST HTTP action and Content-Type application/json. I've included the latter in the Header tab of the Download tool along with my Authorization and Host (www.googleapis.com).
Is there anyone out there that happens to have some experience downloading data from the Search Analytics API or using a JSON query in the download tool? I've tried including the payload as constant values, written JSON string and a JSON field from the JSON build tool, but none have been successful.
{ "startDate": "2016-07-01", "endDate": "2016-07-05", "dimensions": ["Date"] }
I imagine covnerting the JSON string to encoded URL would work; I've tried this too but also no success.
Look forward to your replies.
Kind Regards,
Wesley
Solved! Go to Solution.
It would seem I am a little premature. I just made it work using the JSON Create Macro as an input in the payload. :)
For others looking for the set-up:
URL: https://www.googleapis.com/webmasters/v3/sites/SITEURL/searchAnalytics/query
Configuration of Download tool:
Basic URL = Field URL
Output = String data encoded as Unicode UTF-8
Header Name Content-Type : application/json & Name Host : www.googleapis.com & Authorization Token
Payload = Take Query String/Body from Field JSON Create Output
Will post screenshots later.
It is a very finicky process, and I spent quite some time making it work...
Here are the screenshots of the Download Tool Settings
For the URL, use a STRING formula with this content:
'https://www.googleapis.com/webmasters/v3/sites/[input your website]/searchAnalytics/query'
where [input your website] needs to be formatted this way in case of HTTPS:
‘https://www.googleapis.com/webmasters/v3/sites/https%3A%2F%2Ftechcrunch.com%2F/searchAnalytics/query’
For the Payload, a V_WSTRING formula with this content:
/* Used to extract all queries for a single day */
'{
"startDate": "'+[startDate]+'",
"endDate": "'+[startDate]+'",
"dimensions": ["date","query","page","country","device"]
}'
Overall, it is a quite challenging API, but very useful. I posted my R&D here:
http://insightsthroughdata.com/how-to-analyze-easily-google-search-console-data-in-tableau/
Cheers,
Frederic
I couldn't get this setup working untill i changed some settings; which you can read here:
I'm very happy with this now! :-)
@fpinchon wrote:It is a very finicky process, and I spent quite some time making it work...
Here are the screenshots of the Download Tool Settings
For the URL, use a STRING formula with this content:
'https://www.googleapis.com/webmasters/v3/sites/[input your website]/searchAnalytics/query'
where [input your website] needs to be formatted this way in case of HTTPS:
‘https://www.googleapis.com/webmasters/v3/sites/https%3A%2F%2Ftechcrunch.com%2F/searchAnalytics/query’For the Payload, a V_WSTRING formula with this content:
/* Used to extract all queries for a single day */
'{
"startDate": "'+[startDate]+'",
"endDate": "'+[startDate]+'",
"dimensions": ["date","query","page","country","device"]
}'
Overall, it is a quite challenging API, but very useful. I posted my R&D here:
http://insightsthroughdata.com/how-to-analyze-easily-google-search-console-data-in-tableau/
Cheers,
Frederic