private static dynamic GetEnumJson(SenseApiSupport senseApiSupport) { try { return(senseApiSupport.RequestWithResponse( ApiMethod.Get, $"https://{senseApiSupport.Host}:4242/qrs/about/api/enums", null, null, HttpStatusCode.OK, JToken.Parse)); } catch (Exception ex) { Trace.WriteLine(ex); return(null); } }
public static SenseApiSupport Create(string host) { var certSupport = new CertSupport(); var exceptions = new List <Exception>(); var hostName = host; foreach (X509Certificate2 clientCertificate in certSupport.GetAllSenseClientCertificates()) { var senseApiSupport = new SenseApiSupport( host, SenseApiUser.RepositoryServiceAccount, clientCertificate); try { senseApiSupport.RequestWithResponse( ApiMethod.Get, $"https://{hostName}:4242/qrs/about", null, null, HttpStatusCode.OK, JToken.Parse); return(senseApiSupport); } catch (Exception exception) { exceptions.Add(new Exception("Request failed using certificate " + clientCertificate.Thumbprint, exception)); } } const string message = "No valid Qlik Sense client certificate found."; if (exceptions.Count > 0) { throw new AggregateException(message, exceptions); } throw new Exception(message); }
public static SenseApiSupport CreateHttp(string host) { var exceptions = new List <Exception>(); var hostName = host; var senseApiSupport = new SenseApiSupport( host, SenseApiUser.RepositoryServiceAccount, null); try { senseApiSupport.RequestWithResponse( ApiMethod.Get, $"http://{hostName}:4242/qrs/about", null, null, HttpStatusCode.OK, JToken.Parse); return(senseApiSupport); } catch (Exception exception) { exceptions.Add(new Exception("Request failed using http ", exception)); } const string message = "Qlik Sense is not accesseble to http."; if (exceptions.Count > 0) { throw new AggregateException(message, exceptions); } throw new Exception(message); }