Reputation: 441
I am looking to display the attendees for a given facebook event on a PHP page. Ideally it would be that graphical display with people's pictures displaying.
I believe this could be done using the facebook graph API, but the following is giving me an error requiring signature:
https://api.facebook.com/method/fql.query?query=SELECT uid FROM event_member WHERE eid = ... AND rsvp_status = 'attending'
Also, how would I even get the eid? Can it simply be parsed off the end of an event page link? www.facebook.com/events/...eid#...
Thanks everybody!
Upvotes: 1
Views: 4033
Reputation: 25918
To get event attendees you can run following FQL query:
SELECT uid FROM event_member WHERE eid = "EXISTING_EVENT_ID"
Event id is something you can get from many sources, if you create event via Graph API you'll get event id as response. Or you can get ids of events current/specific user attending. Or as you already noted from URL of event page.
Next FQL query will return all events current user is attending:
SELECT eid FROM event_member WHERE uid = me() AND rsvp_status = "attending"
Queries can be nested so you can do stuff like get list of all attendees of all events current user ever attended:
SELECT eid, uid FROM event_member WHERE eid IN (
SELECT eid FROM event_member WHERE uid = me() AND rsvp_status = "attending"
)
To get details of attendees for specific event something like this may do the work:
SELECT uid, name, pic_square FROM user WHERE uid IN (
SELECT uid FROM event_member WHERE eid = "EXISTING_EVENT_ID"
)
NOTES:
access_token
to get public events details.user_events
permission to be granted to your application by this user.http://graph.facebook.com/{USER_ID}/picture
GET
request to https://graph.facebook.com/fql?q={QUERY_HERE}
For more details on FQL and Graph API read documentation, especially on tables event_member
and user
Upvotes: 7