Skip to content

Instantly share code, notes, and snippets.

@kennetham
Created May 5, 2018 05:11
Show Gist options
  • Save kennetham/ff739149439a9ea3eb94f6e0dafe91a9 to your computer and use it in GitHub Desktop.
Save kennetham/ff739149439a9ea3eb94f6e0dafe91a9 to your computer and use it in GitHub Desktop.
Queue Trigger - HTTP POST Logic App
#r "Newtonsoft.Json"
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;
public static void Run(string myQueueItem, TraceWriter log)
{
log.Info($"C# Queue trigger function processed: {myQueueItem}");
SendQueue(myQueueItem);
}
public static async Task<string> SendQueue(string queueItem)
{
using (var client = new HttpClient())
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary.Add("blob_name", queueItem);
string json = JsonConvert.SerializeObject(dictionary);
var requestData = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(String.Format(ConfigurationManager.AppSettings["LogicAppUri"]), requestData);
var result = await response.Content.ReadAsStringAsync();
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment