/// <summary> /// Checks the API key. /// </summary> /// <param name="userConnection">The user connection.</param> /// <returns><c>true</c> if api key is set, otherwise - <c>false</c>.</returns> public static bool CheckApiKey(UserConnection userConnection) { var apiKey = BpmonlineCloudEngine.GetAPIKey(userConnection); if (apiKey.IsNullOrEmpty()) { _log.Warn("\tService API key is empty. Check 'CloudServicesAPIKey' system settings value"); return(false); } return(true); }
private void GetRequiredParameters(out string serviceUrl, out string apiKey) { serviceUrl = SysSettings.GetValue(UserConnection, "AccountEnrichmentServiceUrl", string.Empty); if (serviceUrl.IsNullOrEmpty()) { throw new HttpException((int)HttpStatusCode.InternalServerError, "Enrichment account service url not set"); } apiKey = BpmonlineCloudEngine.GetAPIKey(UserConnection); if (apiKey.IsNullOrEmpty()) { throw new HttpException((int)HttpStatusCode.InternalServerError, "Cloud service api key not set"); } }
private List <ClassificationResult> QueryPrediction(Dictionary <string, object> classifyData) { var apiKey = BpmonlineCloudEngine.GetAPIKey(_userConnection); var serviceUrlArg = new ConstructorArgument("serviceUrl", ServiceUrl); var apiKeyArg = new ConstructorArgument("apiKey", apiKey); IMLServiceProxy proxy = ClassFactory.Get <IMLServiceProxy>(serviceUrlArg, apiKeyArg); List <ClassificationResult> classificationResults = null; try { classificationResults = proxy.Classify(ModelInstanceUId, classifyData); } catch (Exception e) { _log.ErrorFormat("Classification failed with error: {0}", e, e.Message); } return(classificationResults); }
private void CheckRequiredParameters(out string serviceUrl, out string apiKey) { serviceUrl = SysSettings.GetValue(_userConnection, EmailMiningConsts.TextParsingServiceSysSetting, string.Empty); if (serviceUrl.IsNullOrEmpty()) { _metricReporter.Gauge(EmailMiningUnreachableMetricName, 1); throw new IncorrectConfigurationException(EmailMiningConsts.TextParsingServiceSysSetting); } apiKey = BpmonlineCloudEngine.GetAPIKey(_userConnection); if (apiKey.IsNullOrEmpty()) { _metricReporter.Gauge(EmailMiningUnreachableMetricName, 1); throw new IncorrectConfigurationException(CloudServicesAPIKey); } }
private List <double> Predict(MLModelConfig model, IList <Dictionary <string, object> > dataForPrediction) { var apiKey = BpmonlineCloudEngine.GetAPIKey(_userConnection); var serviceUrlArg = new ConstructorArgument("serviceUrl", model.ServiceUrl); var apiKeyArg = new ConstructorArgument("apiKey", apiKey); IMLServiceProxy proxy; try { proxy = ClassFactory.Get <IMLServiceProxy>(serviceUrlArg, apiKeyArg); } catch (IncorrectConfigurationException ex) { _log.WarnFormat($"Can't predict value for model {model.Id}", ex); throw; } var predictionResults = Predict(model, dataForPrediction, proxy); return(predictionResults); }