C# 如何从C查询Mixpanel#

C# 如何从C查询Mixpanel#,c#,post,webclient,mixpanel,C#,Post,Webclient,Mixpanel,我对C#的web访问非常陌生,对Mixpanel也完全陌生。我正在尝试使用以下代码运行查询: using (WebClient wc = new WebClient()) { wc.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); byte[] creds = UTF8Encoding.UTF8.GetBytes("<my API

我对C#的web访问非常陌生,对Mixpanel也完全陌生。我正在尝试使用以下代码运行查询:

using (WebClient wc = new WebClient())
{
  wc.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
  byte[] creds = UTF8Encoding.UTF8.GetBytes("<my API secret>:");
  wc.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(creds));
  var reqparm = new System.Collections.Specialized.NameValueCollection();
  reqparm.Add("script", "function main() { return Events({\"from_date\":\"2016-10-01\",\"to_date\":\"2016-10-167\"}).reduce(mixpanel.reducer.count()); }");
  byte[] responsebytes = wc.UploadValues("https://mixpanel.com/api/2.0/jql", "POST", reqparm);
}
我在上面尝试了很多变化,但是
UploadValues
总是返回400(错误请求)。我做错了什么


TIA在我没有注意到的一个日期(“2016-10-167”)中有一个错误。

在我没有注意到的一个日期(“2016-10-167”)中有一个错误

function main()
{
  return Events
  ({
    from_date: "2016-01-04",
    to_date: "2016-01-04"
  }).reduce(mixpanel.reducer.count());
}