Domanda

I'm trying to get keyword statistics using the bing webmaster API by sending JSON GET requests. The parameters are as following:

List<KeywordStats> GetKeywordStats(  
    string q,  
    string country, //optional  
    string language //optional  
)

So at first I generated my uri this way:

https://ssl.bing.com/webmaster/api.svc/json/GetKeywordStats?apikey=myAPIKey&q=kreeft&country=BE&language=nl

This returned the following response:

status: 400
{ "ErrorCode": 2, "Message": "UnknownError" }

Trying to solve the problem I simplified my url by not setting the optional parameters resulting in the following query:

https://ssl.bing.com/webmaster/api.svc/json/GetKeywordStats?apikey=myApiKey&q=kreeft

The response on this query was even more puzzling:

status: 200
{"d":[]}

Which just looks like an empty response to me.
I queried those links both from localhost (using postman) and from my webserver at one.com, both giving the same results.

So I have 2 questions actually:
- Why do I have empty responses
- Why are my parameters not accepted

Thanks in advance

È stato utile?

Soluzione

The country code must be lowercase, and the language code must include the country component (in uppercase). yes, it is inconsistent and not specified anywhere.

https://ssl.bing.com/webmaster/api.svc/json/GetKeywordStats?apikey=myAPIKey&q=kreeft&country=be&language=nl-BE

For more, see the blog article: http://bing-webmaster-api.analyticsedge.com/2014/05/getkeywordstats/

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top