Skip to content

Instantly share code, notes, and snippets.

@fabriciosanchez
Created October 31, 2019 13:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save fabriciosanchez/1452ddee65121fc8b79801e26931d3f7 to your computer and use it in GitHub Desktop.
[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