Page 1 of 1

WebClient JavaScript Error

Posted: Mon Oct 31, 2016 6:37 am
by boonec6
I'm trying to make a WebClient call, but I'm receiving an error when testing it in the browser or on a device.

Code: Select all

Unhandled exception at line 0:
Script error.
More details can be found in the JavaScript Console output.


My block of code is:

Code: Select all

        public string getParent(string creds)
        {
            string json1 = "{\"jsonrpc\":\"2.0\",\"method\":\"findLeads\",\"params\":{\"query\":{\"number\":" +
            NSLeadBox.Text +
                        //7218 +
            "},\"stubResponses\":false},\"id\":\"apeye\"}";
            var webClient = new WebClient();
            webClient.Headers[HttpRequestHeader.Accept] = "application/json";
            webClient.Headers.Add("Authorization", "Basic " + creds);
            string response = webClient.UploadString("https://app01.nutshell.com/api/v1/json/", json1);

            return response;
        }


The program runs as expected in the simulator. Any ideas on where I'm going wrong?