Facebook FQL find all events that take place at a

2020-02-13 04:21发布

问题:

I am currently making an app that lists events in a city. I only want events that happen in certain venues to be included. Since the events are all created by many different promoters pages which change very often I thought the easiest way is to search for events whose venue matches my desired venue. How should I use FQL to query this or is it possible? I was thinking something along the lines of:

SELECT eid,name,description FROM event WHERE venue.name='myVenue'

but it wont work (I know the syntax is probably a bit off)

If anybody has any idea how to write this query please help. Thank you so much. Niall

回答1:

This is not possible, because the venue name itself is not an indexable field, although it's marked as one in the docs (see https://developers.facebook.com/docs/reference/fql/event/).

I found a workaround which is a little complicated, but it seems to work:

select eid,name,description,start_time from event where eid in (SELECT eid FROM event WHERE contains("{YOUR_LOCATION_NAME}")) and venue.id = {YOUR_LOCATION_ID} and start_time > now() order by start_time ASC

So, what you need to do first to be able to use this is to make a "list" of locations with their names and id, and query each location one by one. Thereby, you can make use of the Batch Query functionality of the Graph API (https://developers.facebook.com/docs/graph-api/making-multiple-requests/#simple).