@敬一 吉田 Thanks for getting back. I also tried with the above sample and it worked fine.
string _url = "https://westus.cognitiveservices.azure.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=headpose,mask,qualityforrecognition&recognitionModel=recognition_04&returnRecognitionModel=false&detectionModel=detection_03&faceIdTimeToLive=86400";
string _key = "XXXXXXXXXXXXXXXXXXXXXXX"; // Replace with your subscription key
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(_url);
wr.ContentType = "application/json";
wr.Method = "POST";
wr.Headers.Add("Ocp-Apim-Subscription-Key", _key);
// Define the request body as a JSON string
string jsonRequestBody = @"{
""url"": ""https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50.jpg""
}";
// Convert the JSON request body to a byte array
byte[] postData = System.Text.Encoding.UTF8.GetBytes(jsonRequestBody);
Stream rs = wr.GetRequestStream();
rs.Write(postData, 0, postData.Length);
rs.Close();
HttpWebResponse wresp = (HttpWebResponse)wr.GetResponse();
// Read and display the response content
using (StreamReader streamReader = new StreamReader(wresp.GetResponseStream()))
{
string responseStr = streamReader.ReadToEnd();
Console.WriteLine("Response:");
Console.WriteLine(responseStr);
}
wresp.Close();
Action Plan:
Our docs, doesn't mention about any changes being done to FACE API starting Oct 7th 2023.
Could you please share the complete response headers and response body that you received while getting 400 error code ? You can check this from fiddler trace while accessing your above code. This should help us identify the cause of the issue.
Awaiting your reply.