// GET: Todos/Create public IActionResult Create() { string guid = Guid.NewGuid().ToString(); try { string s = string.Format(@"{{""name"":""Joseph {0}""}}", Guid.NewGuid().ToString()); _context.ExecuteSP(); using (var client = new HttpClient()) { _logger.LogInformation("Calling Logic Apps."); var content = new StringContent(s, Encoding.UTF8, "application/json"); var response = client.PostAsync("https://XXXXXXXXXX.logic.azure.com:443/workflows/YYYYYYYYYYYYY/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=hQYQhpnMLwT6LHZSmj8HJPHR6_Xh7FOS8dBXzuTkzZw", content).Result; if (response.StatusCode == System.Net.HttpStatusCode.OK) { _logger.LogInformation(string.Format("Logic Apps called successfully with runid {0} and correlationid {1}.", ((string[])response.Headers.GetValues("x-ms-workflow-run-id"))[0], ((string[])response.Headers.GetValues("x-ms-correlation-id"))[0])); } else { throw new Exception(string.Format("Logic Apps called failed with status code {0}.", response.StatusCode.ToString())); } } _logger.LogInformation("Create called successfully."); } catch (Exception ex) { _logger.LogError(ex, "Exception in calling Create View : " + guid); throw new WebException("Exception occured :" + guid); } return(View()); }