Search code examples
javascriptazure-cognitive-servicesface-api

Microsoft Face API error in method identify()


I am using project oxford for Microsoft Face API in JavaScript, when I use the function "identify", I receive "Invalid request body."

                    client.face.identify({
                       faces: arrayFaceId,
                       personGroupId: "groupId",
                       maxNumOfCandidatesReturned: 1,
                       confidenceThreshold: 0.8
                    }).then(function(response){
                       console.log('Response ' + JSON.stringify(response.personId));
                    }, function(error){
                     console.log("Error2"+JSON.stringify(error));
                   });

Anyone knows how I could fix it?


Solution

  • The API in question takes regular arguments, not an object as you've specified. So:

    client.face.identify(arrayFaceId, "groupId", 1, 0.8)
        .then(function(response) {
            console.log('Response ' + JSON.stringify(response.personId));
        })
        .catch(function(error) {
            console.log("Error " + JSON.stringify(error));
        });