Skip to main content

C Sharp

using System.Threading.Tasks;using System.Net.Http;using System.Net.Http.Headers;using System.Text.Json;namespace WebApiRequest{  class testATM  {    private static readonly HttpClient client = new HttpClient();    private static async Task AtmHttpRequest()    {      client.DefaultRequestHeaders.Accept.Clear();      client.DefaultRequestHeaders.Add("apiKey", "< YOURTOKEN >");      var bodyContent = new StringContent("{\"options\": { \"method\": \"GET\",\"headers\": {\"Content-Type\": \"application/json\",\"Accept\": \"application/json\"}}, \"url\": \"/rest/api/3/issue/Dev-16\"}", System.Text.Encoding.UTF8, "application/json");      var response = await client.PostAsync(new Uri("< YOURTRIGGERURL >"),bodyContent);      string responseString = await response.Content.ReadAsStringAsync();      Console.WriteLine(responseString);    }    static async Task Main (string[] arg){      await AtmHttpRequest();    }  }}