Search code examples
facebookfacebook-fql

Facebook Graph API Get All Events For Latitude and Longitude


I'm trying to get All public events for given location. Here is what I'm using now

SELECT+name,+pic_cover,start_time,+end_time,+location,+description,venue++FROM+event+WHERE+eid++in(SELECT+eid+FROM+event_member+WHERE+uid+IN+(SELECT+page_id+FROM+place+WHERE+distance(latitude,+longitude,+"40.1811",+"44.5136")+<+50000+limit+0,15000))+ORDER+BY+start_time+desc+limit+0,1500

But there are huge count of events with that location which didn't returning with that FQL query. Is there any chance to get all events for given location or it may be by City ?
I'm using Python , but if you have some example code on any language please write it out.


Solution

  • I think if you omit the subquery for the event_member table, you'll eventually get more results. Please consider that the results will only include Events created by the Page itself, not those created by individual users.

    SELECT name, pic_cover,start_time, end_time, location, description,venue FROM event WHERE creator IN (SELECT page_id FROM place WHERE distance(latitude, longitude, "40.1811", "44.5136") < 50000 limit 0,15000) and start_time > now() ORDER BY start_time desc limit 0,1500 
    

    If you have a list of venues of interest, you could use the method I described here: Facebook FQL find all events that take place at a certain venue

    Edit 2017-12-20:

    As it is now impossible to use FQL if the app was created after 2014-04-30, a direct search is no longer possible. To achieve that, a three-step approach must be used, as implemented in https://github.com/tobilg/facebook-events-by-location-core for example.