Created
October 31, 2019 13:34
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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