You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
894 B

  1. using JMETxnPushScheduler.Business;
  2. using System;
  3. using System.Net.Http;
  4. using System.Net.Http.Headers;
  5. namespace JMETxnPushScheduler.API
  6. {
  7. public class RestApiClient
  8. {
  9. private static int timeOut = 100;//Convert.ToInt16(ConfigurationManager.AppSettings["ApiTimeOutSeconds"]);
  10. public static HttpClient CallJMEThirdParty()
  11. {
  12. string thirdPartyUrl = GetStatic.ReadWebConfig("JMECoreAPIURL", "");
  13. var httpClient = new HttpClient();
  14. httpClient.BaseAddress = new Uri(thirdPartyUrl);
  15. httpClient.DefaultRequestHeaders.Add("apiAccessKey", GetStatic.ReadWebConfig("JMECoreAPI_HeaderToken", ""));
  16. httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
  17. httpClient.Timeout = new TimeSpan(0, 0, timeOut);
  18. return httpClient;
  19. }
  20. }
  21. }