question

MrT-7087 avatar image
0 Votes"
MrT-7087 asked ·

Receiving Error 401

Hi,

I have entered:
curl -H "Ocp-Apim-Subscription-Key: <key>" https://api.bing.microsoft.com/v7.0/search?q=microsoft+devices


and got this error:

{"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."}}

Please advise.
thx

azure-bing-web
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

romungi-MSFT avatar image
0 Votes"
romungi-MSFT answered ·

@MrT-7087 I think you are using your Subscription id instead of subscription key of your bing resource in the request header Ocp-Apim-Subscription-Key. Please navigate to your resource on Azure portal and copy the keys from the keys and Endpoint section.

56919-image.png

I am also masking your ID to ensure it is not shared on this public forum.


image.png (77.4 KiB)
· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@MrT-7087 Just curious to check if this resolved your issue. It would be great to mark this as an answer if it helped. Thanks!!

0 Votes 0 ·