我正在尝试检索已邀请用户登录的事件。当我测试一些东西时,我在尝试这个FQL查询时遇到了这个错误:
public static List<GraphLocation> getEvents(Session session, Map<String, Object> queryParams){
limpar();
queryStringBuilder.append("SELECT eid, all_members_count, attending_count, declined_count, description, end_time, version, " +
"name, location, pic, privacy, start_time, ticket_uri, timezone, unsure_count, venue " +
"FROM event");
if(queryParams != null && !queryParams.isEmpty()){
whereClause.append(" WHERE ");
if(!queryParams.containsKey("dataInicio")){
whereClause.append("start_time = " + formatter.format((Date) queryParams.get("dataInicio")));
}
}
queryStringBuilder.append(whereClause.toString());
Bundle params = new Bundle();
params.putString("q", queryStringBuilder.toString());
Request request = new Request(session, "/fql", params, HttpMethod.GET,
new Request.Callback() {
@Override
public void onCompleted(Response response) {
System.out.println(response.toString());
}
});
Request.executeBatchAsync(request);
return null;
}
private static void limpar(){
queryStringBuilder = new StringBuilder();
whereClause = new StringBuilder();
}
以下是imageshack上图像错误的链接:http://img163.imageshack.us/img163/6848/erroew.png
如果有人能告诉我为什么会发生这个问题,我会非常高兴,无论如何,如果有人能解释我如何抓住特定用户被邀请参加的活动,我会更高兴。
非常感谢。
答案 0 :(得分:1)
FQL查询需要一个WHERE语句,这是“意外的查询结束”异常的原因。
您正在寻找的查询是
SELECT eid, all_members_count, attending_count, declined_count, description, end_time, version, name, location, pic, privacy, start_time, ticket_uri, timezone, unsure_count, venue
FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid = XXXXXXX )
ORDER BY start_time asc
将XXXXXXX替换为facebook用户ID。
为了在将FQL查询集成到您的代码之前对其进行测试,您可以使用Facebook Graph API Explorer,例如here。
注意:不要忘记为您的Facebook应用添加“user_events”权限。