Access denied due to invalid subscription key (Face API)

I'm having problems using the Microsoft Face API. The following is an example of my query:

curl -v -X POST "https://westus.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=age,gender" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: 1xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxd" --data-ascii "{\"url\":\"http://www.mrbeantvseries.co.uk/bean3.jpg\"}"

I am using the subscription identifier from my cognitive services account and I received the answer below:

{
  "error": {
    "code": "Unspecified",
    "message": "Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key."
  }
}

Not sure if I missed something. Can someone help me with this? Very much appreciated.

+9
source share
5 answers

Looks like you entered your Azure subscription id? On the Azure portal, you can find the API key in the Keys section, shown below:

Azure Portal Screenshot

It will be a 32-bit hexadecimal number, without a hyphen.

+3
source

, , . , , IFaceServiceClient. .

private readonly IFaceServiceClient faceServiceClient = new FaceServiceClient("your key", "Your endpoint");

enter image description here

+6

. API, .

API REST , .

-, . , Cognitive Services → Properties Location, . . enter image description here

-, , . , API Computer Vision, - , 1 2, - https://eastus.api.cognitive.microsoft.com/ /1.0/

API.

+5

CesarB is correct. You must first create a Cognitive Service resource in Azure and then obtain a subscription key from it. the region is not always "western", it really depends on which region you selected when creating the resource. You can also check this at the endpoint of the Resource View.

0
source

Source: https://habr.com/ru/post/1669196/


All Articles