How can i execute fql command by using restFB or facebook4j

206 Views Asked by At

I want to try this FQL command by using facebook4j:

SELECT message, comments.comment_list.text, like_info.like_count FROM stream WHERE (source_id=124707154243128) and ( strpos(lower(message), "iphone 6")>=0 or strpos(lower(message), "s6")>=0)

Console display : fql is deprecated for versions v2.1 and higher. I cant change version of facebook API

I tried this but the same error occur

ConfigurationBuilder cb = new ConfigurationBuilder();
    cb.setDebugEnabled(true).setRestBaseURL("https://graph.facebook.com/v2.0/");

FacebookFactory ff = new FacebookFactory(cb.build()); Facebook facebook = ff.getInstance();

You guys can help me for getting data from this command by using restFB or facebook4j. Thank you

1

There are 1 best solutions below

0
On

With RestFB this should be (code untested):

FacebookClient fbc = new DefaultFacebookClient(accessToken, Version.VERSION_2_0);
List<JsonObject> objList = fbc.executeFqlQuery(fqlQuery, JsonObject.class);

The JsonObject is the generic type. Normally you can use a RestFB type, in your case the generic type is more suitable.