Exam Preparation Quiz

Question 35 of 75

Validate Face API Code For Adding Student Face Images

MDFT Pro, a well-known training agency, is developing a student recognition system using Azure Face API to automatically identify students in training session photos and track attendance. Mark, the Security Systems Developer, is implementing functionality to add student face images to person groups for each course.

The system needs to process photos from student ID cards and training session images that are accessible via URI endpoints. Mark has written code to add face images to person objects in person groups, but he needs to verify that the implementation will work correctly for the student recognition system.

Here is the code Mark has written:

static async void AddFace(string subscription_key, string
personGroupId, string personId, string imageURI)
{
    var client = new HttpClient();
    client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscription_key);
    var endpointURI = $"https://westus.api.cognitive.microsoft.com/face/v1.0/persongroups/{personGroupId}/persons/{personId}/persistedFaces";
    HttpResponseMessage response;
    var body = "{ \"url\": \"" + imageURI + "\"}";
    var content = new StringContent(body, Encoding.UTF8, "application/json");
    response = await client.PostAsync(endpointURI, content);
}

Will this code successfully add a face image to a person object in a person group?

Choose the correct answer from the options below.

Explanations for each answer:

Learn more about Face API implementation:
Face API Implementation
Next Question