خرید بک لینک

Vote count: 0

Im trying to use C# to coect to the Nutshell API

I'm unsure where the method name goes. Is it on the URL or as part of the JSON? I have tried both ways without success. I know my email is valid as I have tried the same method on the nutshell website

Here is my code:-

var httpWebRequest = (HttpWebRequest)WebRequest.Create("http://api.nutshell.com/v1/json/");
httpWebRequest.ContentType = "text/json";
httpWebRequest.Method = "POST";


using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
    string json = "{"method": "getApiForUseame", "user":"myemail@email.com.au"}";

    streamWriter.Write(json);
    streamWriter.Flush();
    streamWriter.Close();
}

var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();

using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
  var result = streamReader.ReadToEnd();
}

What am I doing wrong?

asked 2 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 6 اسفند 1394 ساعت: 6:04

صفحه بندی