代码如下:
..........
var httpWebRequest = (HttpWebRequest)WebRequest.Create(@"https://api.weixin.qq.com/tcb/databasequery?access_token="+accessToken);
httpWebRequest.ContentType = "application/json;";
httpWebRequest.Method = "POST";
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = "{\"env\":\"*******************\",\"query\":\"db.collection(\"usersInfo\").limit(10).skip(0).get()\"}";
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
Console.WriteLine(result.ToString());
}
..............
}
求教!!!
这个错了吧,不是这么写的。
应该是:collection(\\\"usersInfo\\\"),得是3个斜杠。
希望咱们能继续在社区这个大家庭保持交流。
不过,这种写法有点容易出错的。
errmsg是什么?