代码如下:
..........
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());
}
..............
}
求教!!!