Get inviter for an event in facebook API
I have an application and I obtain the list of events for the current logged in user.
I can get the creator of the event but I just can't figure out how can I obtain the user who invited me to a certain event.
Sometimes the creator 开发者_JS百科is not the same as the inviter. Already attending guests can invite other people.
Can I get this info using the facebook API?
Good question and nice-to-have feature but I think the actual Facebook API doesn't allow you to get that information.
The information you can get, about an event:
Graph API: http://developers.facebook.com/docs/reference/api/event/
FQL: http://developers.facebook.com/docs/reference/fql/event/
You could eventually use a "trick" like opening the event page in an iFrame or a popup. Then, with javascript or jQuery get the html contents of that iframe/popup and then get the part that says "FriendName invited you". FriendName = First and last name (+link to profile) of the inviter... It's a dirty solution and probably facebook has some security checks that won't allow this, but maybe it works, let me know ;)
Facebook added a new feature which will achieve what you are looking for. Event_Member's "Inviter" in Facebook's FQL will show you who the inviter is.
You can use FQL for that like:
SELECT inviter FROM event_member WHERE eid=146509188851970 AND uid=me()
You can see the example here:
Graph Explorer
Just remember to change the id of the event.
精彩评论