How to get facebook public events of a specific user? - facebook

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

Related

Get events created by friends (but returning their names too)

I can get events created by my friends:
SELECT eid, name, start_time, pic_cover.source, location, venue FROM event
WHERE creator IN (SELECT uid2 FROM friend WHERE uid1=me())
But I want to get my friends names asociated to that events. How can I think of that?
As FQL doesn't support joins between tables, the only solution I can think of is that you match the names of your friends and the events they created in your application.
Therefore, you'd need to issue two separate statements:
SELECT uid, first_name, last_name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me())
and
SELECT eid, creator, name, start_time, pic_cover.source, location, venue FROM event WHERE creator IN (SELECT uid2 FROM friend WHERE uid1=me())
and then match them via uid (from the first query) and creator (from the second query).

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

FQL multiquery with event CREATOR does not work anymore

I got several iOS apps that make an FQL multiquery to get infos about events by a certain creator.
query1: "SELECT eid, uid FROM event_member WHERE uid = %#"
query2: "SELECT eid, name, venue, location, start_time, creator FROM event WHERE eid IN (SELECT eid FROM #query1) AND start_time>%# AND creator = %#"
up until yesterday, March 12th 2013 this worked just fine.
Now it returns an "unknown error".
if i change query2 to
"SELECT eid, name, venue, location, start_time, creator FROM event WHERE eid IN (SELECT eid FROM #query1) AND start_time>%#"
it works again, but obviously i would have to update all apps to change this query, and i would love to circumvent this.
Is this by design?

Filter facebook events on date in FQL

I'm using a fairly simple FQL-query to query all the events by a page.
SELECT
eid, name, pic_big, start_time, end_time, location, description
, creator, host, venue
FROM
event
WHERE
eid IN ( SELECT eid FROM event_member WHERE uid = {$uid} )
ORDER BY start_time asc
In the time facebook stored it's start_time and end_time in timestamps it was simple to get only future events: ... AND end_time >= {$now} ...
But facebook changed it's fields in timezone format.
Is there an easy way, preferably in fql, to only show the future events?
Unless I'm misunderstanding your problem, I just tried this out on the Facebook Graph API & FQL Explorer and it appeared to work.
The only changes I made to your query was to replace {$uid}and {$now} with me() and now() respectively. The following query returned only future events for my account:
SELECT eid, name, pic_big, start_time, end_time, location, description, creator, host, venue
FROM event
WHERE eid
IN (SELECT eid FROM event_member WHERE uid = me())
AND start_time >= now()
You can view this in action at: Facebook Graph API Explorer Example
And of course be sure you provide the Explorer with a valid access token for your account.

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