1

I have created a separate resource for face detection cognitive service api and it gives the endpoint as follows,

https://southcentralus.api.cognitive.microsoft.com/face/v1.0

so while making request like below,

var byteContent = new ByteArrayContent(fileContents);
byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
var response = await _client.PostAsync("detect?returnFaceId=true&returnFaceAttributes=age,gender,smile,facialHair,glasses,headPose,emotion,hair,makeup,occlusion,accessories,blur,exposure,noise", byteContent);
var responseJson = await response.Content.ReadAsStringAsync();

it throws an error saying,

Resource Not Found

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396

1 Answers1

2

I believe you need to add trailing slash to end of your base URI otherwise the v1.0 will be discarded as per this answer.

So:

var client = new HttpClient { BaseAddress = "https://southcentralus.api.cognitive.microsoft.com/face/v1.0/" };
orhtej2
  • 2,133
  • 3
  • 16
  • 26