Facebook Graph to show Event Attendees

孤者浪人 提交于 2019-12-06 15:58:39

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:

  • You'll need any valid access_token to get public events details.
  • To retrieve events of current user you'll need user_events permission to be granted to your application by this user.
  • You can display user image with only knowing his id with URL in format of http://graph.facebook.com/{USER_ID}/picture
  • You can run FQL queries with Graph API by issuing 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!