public MileageTargetAPIResponse PostMileageTargetRequest() { mileageTargetAPIRequest = null; //CustomHeaders = new Dictionary<string, string>(); // if (string.IsNullOrEmpty(AccessToken)) GetToken(); try { string MileageTargetRequestString = GetRequestString(); //CustomHeaders.Add(CustomerUid, CustomerUID); LogResult.Report(Log, "log_ForInfo", "Request string: " + MileageTargetRequestString); LogResult.Report(Log, "log_ForInfo", "Post to URL: " + AssetServiceConfig.FuelBurnRateAPI); ResponseString = RestClientUtil.DoHttpRequest(AssetServiceConfig.FuelBurnRateAPI, HeaderSettings.PostMethod, AccessToken, HeaderSettings.JsonMediaType, MileageTargetRequestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, CustomHeaders); LogResult.Report(Log, "log_ForInfo", "Response Recieved: " + ResponseString); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Got Error While Getting Data From AlertsManager Service", e); throw new Exception(e + " Got Error While Getting Data From AlertsManager Service"); } try { mileageTargetAPIResponse = JsonConvert.DeserializeObject <MileageTargetAPIResponse>(ResponseString); LogResult.Report(Log, "log_ForInfo", "Deserialized the response"); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Got Error While DeSerializing JSON Object", e); throw new Exception(e + " Got Error While DeSerializing JSON Object"); } return(mileageTargetAPIResponse); }
public void SetMileageTargetAPIDefaultValues(List <string> assetUIDs) { mileageTargetAPIRequest = new MileageTargetAPIRequest { assetUIDs = assetUIDs }; }