有这么一个需求,使用leancloud的api来查询notifications类中的信息,我测试,prod,status等简单的字段都能作为搜索条件开启搜索,但是这却不能应用到where字段。请问如何能指定where字段进行搜索?如何操作?下面是我的代码。
Date date = new Date();
String timestamp = String.valueOf(date.getTime());
String sign = parseStrToMd5L32("" + timestamp + "master key");
String auth = sign + "," + timestamp + ",master";
try {
URIBuilder builder = new URIBuilder("https://leancloud.cn/1.1/notifications");
builder.addParameter("where", "{\"query\":{\"valid\":true},\"sort\":{\"createdAt\":1}}");
builder.addParameter("prod", "dev");
builder.addParameter("status", "done");
builder.addParameter("limit", "0");
builder.addParameter("count", "1");
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(builder.build());
request.setHeader("X-AVOSCloud-Application-Id", "api id");
request.setHeader("X-AVOSCloud-Request-Sign", auth);
request.setHeader("Content-Type", "application/json");
HttpResponse response = client.execute(request);
BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer result = new StringBuffer();
String line = "";
while ((line = reader.readLine()) != null) {
result.append(line);
}
System.out.println(result.toString());
} catch (IOException e) {
e.printStackTrace();
} catch (URISyntaxException e) {
e.printStackTrace();
}