Deprecation Notice

This API portal and the v1 Video Indexer API are now deprecated and will be removed by Aug 1st 2018
Please migrate to the new API portal and v2 of the API at https://api-portal.videoindexer.ai

Code Snippets

Here is another code snippet that demonstrates the usage of all of the APIs together

var apiUrl = "https://videobreakdown.azure-api.net/Breakdowns/Api/Partner/Breakdowns";
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", key);
 
var content = new MultipartFormDataContent();
content.Add(new StreamContent(File.Open(videoPath, FileMode.Open)), "Video", "Video");
 
Console.WriteLine("Uploading...");
var result = client.PostAsync(apiUrl + "?name=some_name&description=some_description&privacy=private&partition=some_partition", content).Result;
var json = result.Content.ReadAsStringAsync().Result;
 
Console.WriteLine();
Console.WriteLine("Uploaded:");
Console.WriteLine(json);
 
var id = JsonConvert.DeserializeObject<string>(json);
 
while (true)
{
    Thread.Sleep(10000);
 
    result = client.GetAsync(string.Format(apiUrl + "/{0}/State", id)).Result;
    json = result.Content.ReadAsStringAsync().Result;
 
    Console.WriteLine();
    Console.WriteLine("State:");
    Console.WriteLine(json);
 
    dynamic state = JsonConvert.DeserializeObject(json);
    if (state.state != "Uploaded" && state.state != "Processing")
    {
        break;
    }
}
 
result = client.GetAsync(string.Format(apiUrl + "/{0}", id)).Result;
json = result.Content.ReadAsStringAsync().Result;
Console.WriteLine();
Console.WriteLine("Full JSON:");
Console.WriteLine(json);
 
result = client.GetAsync(string.Format(apiUrl + "/Search?id={0}", id)).Result;
json = result.Content.ReadAsStringAsync().Result;
Console.WriteLine();
Console.WriteLine("Search:");
Console.WriteLine(json);
 
result = client.GetAsync(string.Format(apiUrl + "/{0}/InsightsWidgetUrl", id)).Result;
json = result.Content.ReadAsStringAsync().Result;
Console.WriteLine();
Console.WriteLine("Insights Widget url:");
Console.WriteLine(json);
 
result = client.GetAsync(string.Format(apiUrl + "/{0}/PlayerWidgetUrl", id)).Result;
json = result.Content.ReadAsStringAsync().Result;
Console.WriteLine();
Console.WriteLine("Player token:");
Console.WriteLine(json);