Open brandflownet opened 8 years ago
I am trying to make POST call towards Search Console API. I got my example running under API Explorer, however when I try to make the same call from my meteor project, I am getting error:
Object {error: Object} error: Object code: 400 errors: Array[1] message: "Parse Error" My code:
function fetchSEOForWebsite(website) { var call = 'webmasters/v3/sites/' + 'mdbootstrap.com' + '/searchAnalytics/query' var params = { "searchType": "web", "dimensions": [ "query", "date", "page" ], "startDate": "2016-02-06", "endDate": "2016-02-08" } GoogleApi.post(call, { params: params }, function(error, answer) { console.log(answer); }); }
From Chrome console I can see POST payload:
searchType=web&dimensions=query%2Cdate%2Cpage&startDate=2016-02-06&endDate=2016-02-08
The same query works perfectly fine from API Explorer :
POST https://www.googleapis.com/webmasters/v3/sites/http%3A%2F%2Fmdbootstrap.com/searchAnalytics/query?key={YOUR_API_KEY} { "searchType": "web", "dimensions": [ "query", "date", "page" ], "startDate": "2016-02-06", "endDate": "2016-02-08" }
I also checked paylod sent via API Explorer and it's different:
{ "searchType": "web", "dimensions": ["query","date","page" ], "startDate": "2016-02-06", "endDate": "2016-02-08" }
So it looks like for some reason my params are not passed as a JSON object to call...
I am trying to make POST call towards Search Console API. I got my example running under API Explorer, however when I try to make the same call from my meteor project, I am getting error:
From Chrome console I can see POST payload:
The same query works perfectly fine from API Explorer :
I also checked paylod sent via API Explorer and it's different:
So it looks like for some reason my params are not passed as a JSON object to call...