getting users attending event data from facebook using FQL - facebook

im having trouble getting information i want with fql.
i want to get the name and uid of all the people rsvped "attending" to a specific event sorted by name.
i know how to get all uid of the users attending to an event using the following query:
SELECT uid FROM event_member WHERE eid = ... AND rsvp_status = 'attending'
unfortunately event_member table doesn't have the name of the uid
and i know how to get the name and uid from event attenders using graph api, but the ther iss no way to get it sorted by name as far as i know.
your thoughts?

found the answer, i forgot there was a table called "user". the solution is
SELECT uid, name FROM user WHERE uid IN
(
SELECT uid FROM event_member WHERE eid = "EXISTING_EVENT_ID" and rsvp_status= "attending"
)
SORT BY name

Try out FQL Query like
SELECT name, venue, location, start_time FROM event WHERE eid IN (
SELECT eid FROM event_member WHERE uid = "USER_ID_HERE" and rsvp_status="attending"
);

Related

Can I get the creator of an facebook event's profile pic, using FQL?

I need to use the following fql to also get the creator's profile pic of an event. The creator column only returns their id, but i'm not sure if there's a way to do both of this nested queries.
SELECT eid, name, location, creator FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid = me())
First you make sure want you want to retrieve.
If you want the name and profile picture of the creator of an event you are in you can use below code:
SELECT name,pic_big FROM user WHERE uid IN (SELECT creator FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid = me()))
But if you need event details also (as you already have that fql) you need to query two separate queries it cannot be done using nested queries

Get Facebook Events I don't Own

I am building a site that needs to query Facebook events. I need a list of events I do own, and list of events I don't own. The problem is that querying the Events object via FQL requires that I pass one of the indexable fields. Those are creator, name, and eid. This is fine when I need my events (creator = me()). However, when I need events I don't own I can't seem to use a SQL like statement in (creator <> me()).
Any suggestions on how to do this?
SELECT name,start_time,end_time,location,eid,pic,description FROM event where creator = me() and start_time >= 1370106582
It's not as straightforward as I would like but this query works.
SELECT name,start_time,end_time,location,eid,pic,description FROM event where eid IN
(SELECT eid FROM event_member WHERE uid = {UserId} and inviter and rsvp_status = 'attending')
If you query for event_member by the Users Id the Inviter field with be null for events in which they are the owner. In FQL if you just add 'Where {field}' in a where clause, it returns all the results in which that field's value is not null. I know that's a bit confusing but it works.

Facebook API: How to use Event's venue.id?

Facebook events have a venue.id, how can I use them? Can they be converted to actual addresses?
For example, the venue id for this event is "132764236748017". I found it by running the following fql code,
SELECT venue FROM event WHERE eid IN (SELECT eid from event_member WHERE uid= me())
Is 'venue id' the id of a place?
EDIT: I found the answer
I could use 'SELECT name,description,geometry,latitude,longitude,checkin_count,display_subtext FROM place WHERE page_id=110506962309835' where page_id is the same as venue.id

Facebook API: how to get event details

Trying to get the details of all events me/my friends are attending/maybe attending in the coming month (date manipulations in the FQL).
I am also in need of getting those events' feeds for further analysis in my program.
So far I found Facebook API's documentation hardly any helpful.
You can use the event and event_member tables in conjunction with the friend table to get this data.
Eg:
SELECT eid, name, location, start_time FROM event WHERE eid in ( select eid from event_member where rsvp_status != 'declined' and uid = me() or uid in (select uid2 from friend where uid1 = me()) ) AND start_time >= '2012-08-01' and start_time <= '2012-08-31'

Facebook FQL Subquery

Im using the below query to fetch all the events that I have accepted the invitation to:
NSString *eventQuery = #"SELECT eid, name, creator FROM event WHERE eid IN
( SELECT eid FROM event_member WHERE uid = me() AND rsvp_status='attending' )";
This works perfectly, but now I want to get the name of the creator too. Since the creator field is just the userid of the creator I have to do another subquery.
Can someone help me with this?
Thank you so much for your time!
You need to issue an FQL multiquery to get this. I'm not sure of how you do this in Objective C, but the FQL syntax is:
{
"user_events":
"SELECT eid, name, creator FROM event WHERE eid IN
(SELECT eid FROM event_member WHERE uid=me() and rsvp_status='attending')",
"event_creators":
"SELECT name, id FROM profile WHERE id IN
(SELECT creator FROM #user_events)"
}
Your original problem with no "maybe" events getting returned is because rsvp_status='maybe' is incorrect. rsvp_status='unsure' is the correct syntax.