3

I'm trying to search facebook pages with graph api's search method. I'm using restFB- a java library for facebook graph api. When i run this

AccessToken accessToken =
  new DefaultFacebookClient().obtainAppAccessToken(MY_APP_ID, MY_APP_SECRET);
FacebookClient facebookClient = new DefaultFacebookClient(accessToken.getAccessToken());

Connection<Page> pageSearch = facebookClient.fetchConnection("search",Page.class,Parameter.with("q","SEARCH_QUERY"));

this search returns around 500 results, and returned pages are country or language depended. I mean when I run this code on a VPS on europe results were completely different.So I tried graph explorer tool like

https://graph.facebook.com/search?locale="el_GR"&q="SEARCH_QUERY"&type=page&access_token={UserAccessToken}

results were Greek pages as I needed. So naturally i tried this

Connection<Page> pageSearch = facebookClient.fetchConnection("search",Page.class,Parameter.with("q","SEARCH_QUERY"),
Parameter.with("locale","el_GR"));

but no Greek pages returned.I also tried a user access token in restFB like

FacebookClient facebookClient = new DefaultFacebookClient({USER_ACCESS_TOKEN});
Connection<Page> pageSearch = facebookClient.fetchConnection("search",Page.class,Parameter.with("q","SEARCH_QUERY"),
Parameter.with("locale","el_GR"));

but again no Greek pages returned. If anyone can help, it would be great. Thanks

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
reyalsnogard
  • 496
  • 6
  • 9

0 Answers0