Dong-Yoon Choi Dong-Yoon Choi - 1 year ago 133
C# Question

Microsoft Emotions API Get Recognition in Video Operation Result

How do I return the status and results from a video I posted to the emotions api using Get Recognition in Video Operation Result?

I can successfully run the Get Recognition in Video Operation Result using an operation id of a video I uploaded, but the response does not show the status of the video and the results from the emotions API but only shows the following:

StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.StreamContent,
Pragma: no-cache
apim-request-id: 010962c0-f907-4ba3-a7fd-564ddff7f97d
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Cache-Control: no-cache
Date: Wed, 02 Nov 2016 02:33:16 GMT
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Content-Length: 16048
Content-Type: application/json; charset=utf-8 Expires: -1 }

I've tried using the same oid in the open api testing console


and the response returns the status and the results from the emotions api.

I'm using the following code from the API reference:

var client = new HttpClient();
var queryString = HttpUtility.ParseQueryString(string.Empty);

// Request headers
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "{subscription key}");

var uri = "{oid}?" + queryString;

var response = await client.GetAsync(uri);

Answer Source

Based on what you've pasted, it looks like you do have a response, 16048 bytes of JSON.

Since you're using C#, I think you'll save a lot of effort by using the client library, authored by members of the Cognitive Services team. If you use Visual Studio, you can simply pull down the NuGet package.

If you don't want to use the prebuilt library, you'll need to parse out the JSON yourself. The JSON will be in response.Content.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download