Monday, June 17, 2019

MakePostRequest using HTTPCLIENT


JObject MakePostRequest(Dictionary<string,string> dict, string url )
        {
            try
            {
                HttpClient client = new HttpClient();
                client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token);
                var body = new StringContent(JsonConvert.SerializeObject(dict), Encoding.UTF8, "application/json");
                var response = client.PostAsync(url, body).GetAwaiter().GetResult();
                var responseString = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
                return JObject.Parse(responseString);
            }
            catch (Exception e)
            {
                Console.WriteLine("Error : " + e.ToString());
            }
            return JObject.Parse("{}");

        }

No comments:

Power Automate + Excel data

Extract excel data, get manager and update row with user details which will get from GET MANAGER Concepts and examples Key column:  Column i...