Nutshell API身份验证与C#

Nutshell API身份验证与C#,c#,httpwebrequest,C#,Httpwebrequest,我正在尝试使用C#连接到Nutshell API 我不确定方法名在哪里。它是在URL上还是作为JSON的一部分?我两种方法都试过了,但都没有成功。我知道我的电子邮件是有效的,因为我在nutshell网站上尝试过同样的方法 这是我的密码: var httpWebRequest = (HttpWebRequest)WebRequest.Create("http://api.nutshell.com/v1/json/"); httpWebRequest.ContentType = "text/json

我正在尝试使用C#连接到Nutshell API

我不确定方法名在哪里。它是在URL上还是作为JSON的一部分?我两种方法都试过了,但都没有成功。我知道我的电子邮件是有效的,因为我在nutshell网站上尝试过同样的方法

这是我的密码:

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\": \"getApiForUsername\", \"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();
}

我做错了什么?

您希望您的响应体如下所示:

{"jsonrpc":"2.0","method":"getUser","params":[],"id": "apeye"}
对于此url:

https://app01.nutshell.com/api/v1/json
提示:使用JSON序列化程序创建JSON字符串