Skip to content Skip to sidebar Skip to footer

Is Microsoft Face Api Verification (face To Face) Down? Always Says Bad Request And Documentation Console Shows Error

Here is what I've been trying: subscription_key = '***' assert subscription_key face_api_url = 'https://southeastasia.api.cognitive.microsoft.com/face/v1.0/verify' headers = {'O

Solution 1:

Based on the Verify API we could know that faces should be in the body part not in the params

subscription_key = "xxxx"assert subscription_key
importjsonface_api_url='https://westus.api.cognitive.microsoft.com/face/v1.0/verify'
headers = {'Ocp-Apim-Subscription-Key': subscription_key,'Content-Type':'application/json'}
faces = {
    "faceId1": "xxxxxxxx",
    "faceId2": "xxxxxx"
}

body = json.dumps(faces)
import requests
from pprint importpprintresponse= requests.post(face_api_url, headers=headers,data=body)
result = response.json()
pprint(result)

Test Result:

enter image description here

We also could do that easily with python SDK

import cognitive_face as CF
KEY = 'xxxxxx'# Replace with a valid subscription key (keeping the quotes in place).
CF.Key.set(KEY)

BASE_URL = 'https://{location}.api.cognitive.microsoft.com/face/v1.0'# Replace with your regional Base URL
CF.BaseUrl.set(BASE_URL)
result = CF.face.verify("faceId1","faceId2")
print(result)

Post a Comment for "Is Microsoft Face Api Verification (face To Face) Down? Always Says Bad Request And Documentation Console Shows Error"