为什么在 Android 中使用 Azure face API 进行 URL 调用时会出现 FileNotFoundException?

Why do I get a FileNotFoundException for a URL call in Android on using Azure face API?

这是我在 Android 上尝试比较两张面孔是否属于同一个人的方法。我还在最后提供了我的错误代码。这跟API有关系吗?

try {
    URL url = new URL("https://southeastasia.api.cognitive.microsoft.com/face/v1.0/verify?faceId1=" + face1 + "&faceId2=" + face2);
    HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
    urlConnection.setRequestProperty("Ocp-Apim-Subscription-Key", "----");
    try {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
        StringBuilder stringBuilder = new StringBuilder();
        String line;
        while ((line = bufferedReader.readLine()) != null) {
            stringBuilder.append(line).append("\n");
        }
        bufferedReader.close();
        getting = stringBuilder.toString();
        Log.v("Gettinganswer", getting);
        return  getting;
    } finally {
        urlConnection.disconnect();
    }
}
catch(Exception e) {
    Log.e("ERROR", e.getMessage(), e);
    return null;
}

2018-10-24 23:45:44.200 25987-26725/com.example.android.staysaferesq E/ERROR: https://southeastasia.api.cognitive.microsoft.com/face/v1.0/verify?faceId1=03ab5c58-86bb-4eef-a89e-56d4ce76e95b&faceId2=03ab5c58-86bb-4eef-a89e-56d4ce76e95b
    java.io.FileNotFoundException: https://southeastasia.api.cognitive.microsoft.com/face/v1.0/verify?faceId1=03ab5c58-86bb-4eef-a89e-56d4ce76e95b&faceId2=03ab5c58-86bb-4eef-a89e-56d4ce76e95b
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:251)
        at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
        at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(Unknown Source:0)
        at com.example.android.staysaferesq.FaceActivity$RetrieveFeedTask.doInBackground(FaceActivity.java:301)
        at com.example.android.staysaferesq.FaceActivity$RetrieveFeedTask.doInBackground(FaceActivity.java:275)
        at android.os.AsyncTask.call(AsyncTask.java:333)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor.run(AsyncTask.java:245)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)

Does this have something to do with the API?

根据文档我们可以知道人脸验证API端点应该是

post https://[location].api.cognitive.microsoft.com/face/v1.0/verify

正文格式为

{
 "faceId1": "xxxxxxxx",
 "faceId2": "xxxxx",
}