Reputation: 805
Help! I'm trying to search for public events by location using the Facebook Graph API. I've seen many posts saying that this is not possible with the current version of the Graph API out now or FQL. But, I do see sites with this feature as well as many FQL workarounds. None have been successful for me.
Here are my search parameters being requested from the API
/search?q=*&type=event¢er=10.4434041,-61.419835&distance=1000
It was my hope that this would be the answer, simply because it seems to cover the type event and specific location. But, I was wrong and I get a list of the same marketing event for a free samsung galaxy 20 years into the future in 30 different languages.
So I thought to query for the venue(place) in that specific location, which turned out successful, and then grab the id's from those venues and query each id one by one to see if there are any associated events to that specific venue. I don't know how to go about the second half of the query with the results of the first search query but this is what I have so far.
/search?type=place&q=*¢er=10.4434041%2C-61.419835&distance=1000&fields=name,id
Returns
{
"data": [
{
"name": "Valid Venue!",
"id": "740199068928858"
},
{
"name": "Valid Venue!",
"id": "522158807878843"
},
{
more valid venue data!!
}
}
I should also note that this venue search will give me all listed places in that location, which, I know is VERY bad and completely inefficient but I'm all out of ideas.
I'm not sure if this is the right path to go down but it seems like the most plausible solution I can think of to get events by location. Any guidance or at all would be greatly appreciated!!
Thanks!!
Upvotes: 5
Views: 14887
Reputation: 291
For version 2.11 onwards, the best/easiest way I can see to achieve this is to add your location value into the query itself, as q=
looks beyond just the name of your event.
Example:
https://graph.facebook.com/v2.11/search?q=marathon%20dublin&type=event&fields=name,id,category,description,place&access_token=ACCESSTOKEN
returns the below event (amongst others). You can see that Dublin was picked up from the Place fields as it is not mentioned in the name
{
name: "Vhi Women's Mini Marathon 2018",
id: "1803645183261605",
description: "The Vhi Women's Mini Marathon is returning to a Sunday
for 2018!! This year, on 3rd June 2018, we want you to join us by
walking, jogging or running 10k in Dublin. Sign up from 7 March and
follow our 12 week training and nutrition plan on line and with the
The Herald each Wednesday and Saturday. Don't forget to follow us on
facebook for lots of competitions and important information about the
event.",
place: {
name: "Fitzwilliam Place, Dublin, County Dublin, Ireland"
}
}
Upvotes: 0
Reputation: 31479
This used to work (or still works until August 7th 2016 if you have a v2.0 app, and the event was create by a page with a location/venue set) as described in
for example. With the Graph API itself, it is not possible to search for nearby events in one query.
What you could do is
Keep in mind that you'll have to filter yourself regarding passed events etc. It's very inefficient unfortunately...
EDIT 2017-12-20
You can use https://github.com/tobilg/facebook-events-by-location-core for this use case.
Upvotes: 5