I'd like to use Cognitive Services to use Bing Search APIs. I created Cog Services Account in Azure Portal and used the key listed in properties in my sample app. There are 2 keys which are listed
- Cognitive Services Account https://www.microsoft.com/cognitive-services/en-US/subscriptions and
- Azure Portal for Cognitive Account.
Few questions:
- Which of these keys is the one which we should use?
- Do we also need to set Ocp-Apim-Subscription-Key in the header?
- I am hitting access denied and wondering if there is anything else which is missing in configuring Cognitive services in Azure Portal.
- I am confused if I should be using Bing Api or Cognitive Services? Are both these the same thing?
- Can someone please share very basic example as the one I have below (though very simple) doesn't work.
example simplistic code snippet to show what I am doing:
...
string searchApiUrl = String.Format(
"https://api.cognitive.microsoft.com/bing/v5.0/news/search?q={0}&AccountKey={1}",
WebUtility.HtmlEncode("Movies"),
"MY ACCOUNT ID FROM Azure PORTAL");
HttpClient httpClient = new HttpClient();
string response1 = await httpClient.GetStringAsync(searchApiUrl);
...