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.
25 lines
905 B
25 lines
905 B
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
using System.Net.Http;
|
|
using System.Net.Http.Headers;
|
|
using System.Text;
|
|
|
|
namespace Common
|
|
{
|
|
public class RestApiClient
|
|
{
|
|
private static int timeOut = 100;//Convert.ToInt16(ConfigurationManager.AppSettings["ApiTimeOutSeconds"]);
|
|
public static HttpClient CallJMEThirdParty()
|
|
{
|
|
string thirdPartyUrl = ConfigurationManager.AppSettings["JMECoreAPIURL"].ToString();
|
|
var httpClient = new HttpClient();
|
|
httpClient.BaseAddress = new Uri(thirdPartyUrl);
|
|
httpClient.DefaultRequestHeaders.Add("apiAccessKey", ConfigurationManager.AppSettings["JMECoreAPI_HeaderToken"].ToString());
|
|
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
|
httpClient.Timeout = new TimeSpan(0, 0, timeOut);
|
|
return httpClient;
|
|
}
|
|
}
|
|
}
|