Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[FunctionName("A_InsightsGenerator")]
public static string GeneratesInsights([ActivityTrigger] AMSVideo amsVideoPublished, TraceWriter log)
{
// Building up Json sentence
dynamic flexibleObj = new ExpandoObject();
flexibleObj.assetId = amsVideoPublished.Asset.Id;
flexibleObj.videoFileName = amsVideoPublished.Video.VideoFileName;
flexibleObj.streamingVideoURL = amsVideoPublished.StreamingURL;
var jsonStr = JsonConvert.SerializeObject(flexibleObj);
try
{
using (var client = new HttpClient())
{
var content = new StringContent(jsonStr);
content.Headers.ContentType.CharSet = string.Empty;
content.Headers.ContentType.MediaType = "application/json";
var response = client.PostAsync(_logicappuri, content);
log.Info(response.Result.ToString());
return response.Result.ToString();
}
}
catch (Exception)
{
return string.Empty;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment