public void InvokePackage() { try { var token = new Login().GetToken(); if (token != null) { var customerClientId = new Guid(ConfigurationManager.AppSettings["package/customerclientid"]); var userId = new Guid(ConfigurationManager.AppSettings["package/userid"]); var contractId = new Guid(ConfigurationManager.AppSettings["package/contractid"]); var packageId = new Guid(ConfigurationManager.AppSettings["package/packageid"]); var requestFields = new List<RequestFieldDto> { new RequestFieldDto { Name = "VIN", Value = "W0LPC6EC8DG072314", Type = "0" } }; this.Info(() => "Initiating package invocation"); var response = _apiClient.Post(token, "/action", null, new ApiRequestDto(customerClientId, userId, contractId, packageId, requestFields, false), null); if (response.Contains("error")) throw new LightstoneAutoException(response); this.Info(() => "Package invocation complete"); } } catch (Exception e) { this.Error(() => e.Message); SendEmail("Package invocation error", e.Message); } }
public void ApiLogin() { this.Info(() => "Initiating api login check"); try { var token = new Login().GetToken(); if (token == null) throw new LightstoneAutoException("API Token error"); this.Info(() => "Api login check complete"); } catch (Exception e) { this.Error(() => e.Message); SendEmail("API Login Error", e.Message); } }