Reputation: 57
I would like to use UnityEngine.Networking and StartCoroutine() to retrieve data from Bing API in Unity/C#. I am getting Error 401 which is:
{"error":{"code":"401","message": "Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource."}}
The url that I am attempting to call is:
https://[**MyEndpoint**]/bing/v7.0/news/trendingtopics?BingAPIs-Market=en-US&Ocp-Apim-Subscription-Key=[**KEY**]
I assume the reason for rejection is that I explicitly added Ocp-Apim-Subscription-Key header in the url but not sure %100.
Upvotes: 1
Views: 479
Reputation: 11
Bing API is RESTful API and expects the authentication key in the request header
Upvotes: 0
Reputation: 12153
As @jdweng indicated, you should specify your subscription key in the request header, just as below :
If it is necessary for you using the subscription key in the request URL,the param here should be subscription-key
instead of Ocp-Apim-Subscription-Key
just as below:
Upvotes: 0