Can I get the creator of an facebook event's profile pic, using FQL? - facebook-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

Related

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.

How to get facebook public events of a specific user?

I want to fetch all events of my account or any specific user by its userid.. The below query returns null array.. What is the problem ? If any permission is required, from where i can change it ?
SELECT eid, name, pic, creator FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid=12345) AND creator=12345
Permissions
To get events of the connected user: user_events,
To get events of a friend of the connected user: friends_events,
To get events of a random user: there is no permission, which means that you can't get his events.
The query
SELECT eid, name, pic, creator
FROM event
WHERE eid IN (SELECT eid FROM event_member WHERE uid=12345)
AND creator=12345
What are you trying to get? This query fetches the events of a user who created an event AND participates to it. The thing is, when a user creates an event, he automatically participates to it.
Let me suggest you two queries:
Get the events which a user participates to. This will include the events that the user has created.
SELECT eid, name, pic, creator
FROM event
WHERE eid IN (SELECT eid FROM event_member WHERE uid=12345)
Only get the events which a user created:
SELECT eid, name, pic, creator
FROM event
WHERE creator=12345

getting users attending event data from facebook using FQL

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"
);

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 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.