Ejemplo n.º 1
0
        static async Task InvokeRequestResponseService()
        {
            using (var client = new HttpClient())
            {
                ScoreData scoreData = new ScoreData()
                {
                    FeatureVector = new Dictionary <string, string>()
                    {
                        { "State", "0" },
                        { "Account_Length", "0" },
                        { "Int_l_Plan", "0" },
                        { "VMail_Plan", "0" },
                        { "VMail_Message", "0" },
                        { "Day_Mins", "0" },
                        { "Day_Calls", "0" },
                        { "Eve_Mins", "0" },
                        { "Eve_Calls", "0" },
                        { "Night_Mins", "0" },
                        { "Night_Calls", "0" },
                        { "Intl_Mins", "0" },
                        { "Intl_Calls", "0" },
                        { "CustServ_Calls", "0" },
                        { "Churn_", "0" },
                    },
                    GlobalParameters = new Dictionary <string, string>()
                    {
                    }
                };

                ScoreRequest scoreRequest = new ScoreRequest()
                {
                    Id       = "score00001",
                    Instance = scoreData
                };

                const string apiKey = @"/fqyfFdY1wryxBTaGMfqNFNGq0z4dVvmAHnSMXq3xFnF01Dh37r/tNDO93MQ9RvNliin4TNl/NeTvJivIyBlhA==";
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);

                client.BaseAddress = new Uri("https://ussouthcentral.services.azureml.net/workspaces/bc6795225e2d4bcf8d414b960baad85c/services/28d6553f988b40fa8567845a0c06b4b5/score");
                HttpResponseMessage response = await client.PostAsJsonAsync("", scoreRequest);

                if (response.IsSuccessStatusCode)
                {
                    string result = await response.Content.ReadAsStringAsync();

                    Console.WriteLine("Result: {0}", result);
                }
                else
                {
                    Console.WriteLine("Failed with status code: {0}", response.StatusCode);
                }
            }
        }
Ejemplo n.º 2
0
        static async Task InvokeRequestResponseService()
        {
            using (var client = new HttpClient())
            {
                ScoreData scoreData = new ScoreData()
                {
                    FeatureVector = new Dictionary <string, string>()
                    {
                        { "OFF", "NE" },
                        { "DSEQ", "3" },
                        { "QTR", "1" },
                        { "MIN", "5" },
                        { "QTRSECTION", "2" },
                        { "PTDIFF", "7" },
                        { "TIMO", "3" },
                        { "TIMD", "3" },
                        { "DWN", "3" },
                        { "YTG_BIN", "Long" },
                        { "ZONE", "1" },
                    },
                    GlobalParameters =
                        new Dictionary <string, string>()
                    {
                    }
                };

                ScoreRequest scoreRequest = new ScoreRequest()
                {
                    Id       = "score00001",
                    Instance = scoreData
                };

                const string apiKey = "xTQkImuyYMnLckJb3KV05uAOW9wUv0vKAiEFRgBjOWUoXGhJ7Kvilp3k6aSE2PEAPu3yuQxZl5MH/eEhTy/QtA=="; // Replace this with the API key for the web service
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);

                client.BaseAddress = new Uri("https://ussouthcentral.services.azureml.net/workspaces/7e69e85c761a4003b4ba9efe1952b716/services/bc16c08f0e7c438e8b1d7378bb3f0a28/score");
                HttpResponseMessage response = await client.PostAsJsonAsync("", scoreRequest);

                if (response.IsSuccessStatusCode)
                {
                    string result = await response.Content.ReadAsStringAsync();

                    Console.WriteLine("Result: {0}", result);
                }
                else
                {
                    Console.WriteLine("Failed with status code: {0}", response.StatusCode);
                }
                Console.WriteLine("Press return to continue");
                Console.ReadLine();
            }
        }
Ejemplo n.º 3
0
        static async Task InvokeRequestResponseService()
        {
            using (var client = new HttpClient())
            {
                ScoreData scoreData = new ScoreData()
                {
                    FeatureVector = new Dictionary<string, string>() 
                    {
                        { "State", "0" },
                        { "Account_Length", "0" },
                        { "Int_l_Plan", "0" },
                        { "VMail_Plan", "0" },
                        { "VMail_Message", "0" },
                        { "Day_Mins", "0" },
                        { "Day_Calls", "0" },
                        { "Eve_Mins", "0" },
                        { "Eve_Calls", "0" },
                        { "Night_Mins", "0" },
                        { "Night_Calls", "0" },
                        { "Intl_Mins", "0" },
                        { "Intl_Calls", "0" },
                        { "CustServ_Calls", "0" },
                        { "Churn_", "0" },
                    },
                    GlobalParameters = new Dictionary<string, string>()
                    {
                    }
                };

                ScoreRequest scoreRequest = new ScoreRequest()
                {
                    Id = "score00001",
                    Instance = scoreData
                };

                const string apiKey = @"/fqyfFdY1wryxBTaGMfqNFNGq0z4dVvmAHnSMXq3xFnF01Dh37r/tNDO93MQ9RvNliin4TNl/NeTvJivIyBlhA=="; 
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);

                client.BaseAddress = new Uri("https://ussouthcentral.services.azureml.net/workspaces/bc6795225e2d4bcf8d414b960baad85c/services/28d6553f988b40fa8567845a0c06b4b5/score");
                HttpResponseMessage response = await client.PostAsJsonAsync("", scoreRequest);
                if (response.IsSuccessStatusCode)
                {
                    string result = await response.Content.ReadAsStringAsync();
                    Console.WriteLine("Result: {0}", result);
                }
                else
                {
                    Console.WriteLine("Failed with status code: {0}", response.StatusCode);
                }
            }
        }