Hello @
Devdutta Basu
Thanks for reaching out to us, I want to let you know that Face API Verify feature is under limited access now, if you have not applied for the access and got approval, you may not be able to use it. Please leverage below link for application.
Face API: Identify and Verify features
Document reference, please check here - https://learn.microsoft.com/en-us/azure/ai-services/cognitive-services-limited-access
If you have already got the access, I may recommend you refer to the official sample for JAVA -
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
public class JavaSample
{
public static void main(String[] args)
{
HttpClient httpclient = HttpClients.createDefault();
try
{
URIBuilder builder = new URIBuilder("https://westus.api.cognitive.microsoft.com/face/v1.0/verify");
URI uri = builder.build();
HttpPost request = new HttpPost(uri);
request.setHeader("Content-Type", "application/json");
request.setHeader("Ocp-Apim-Subscription-Key", "{subscription key}");
// Request body
StringEntity reqEntity = new StringEntity("{body}");
request.setEntity(reqEntity);
HttpResponse response = httpclient.execute(request);
HttpEntity entity = response.getEntity();
if (entity != null)
{
System.out.println(EntityUtils.toString(entity));
}
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}
}
Reference document -
I hope this helps.
Regards,
Yutong