FQL multiquery with event CREATOR does not work anymore - facebook

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?

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

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.

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.

Query of past events for a "like" page is not returning full list (as shown on actual page)

The code used to query (below) has not changed since before it was working correctly, but the page suddenly started only displaying one of the many past events. Has the functionality of the QL changed in some way or is this just a bug that I should wait and see if it passes?
SELECT name, pic, start_time, end_time, location, description, eid
FROM event
WHERE end_time < now()
AND eid IN (
SELECT eid
FROM event_member
WHERE uid = XXXXXXXXX )
ORDER BY start_time DESC
I'm not totally sure, but FQL's documentation on event_member might be the key. Have you attempted running only the internal query (SELECT eid FROM event_member WHERE uid = XXXXXXXXX) alone without the wrapper to see what it's returning?
FQL documentation for event_member states that
If you do not specify a start_time, only events in the future will be returned.
EDIT: I take this to mean that you may, currently, need to specify start_time < now() in there, or something of the like.
(Though, if that's case, I'm not sure why you're even getting the one item returned because that would conflict with your end_time < now() statement).
My first suggestion might be to spit it into multiple queries using FQL multiquery and make sure that the event_member query is returning what you'd expect.
Something like:
"event_members":"SELECT eid
FROM event_member
WHERE uid = XXXXXXXXX"
"events":"SELECT name, pic, start_time, end_time, location, description, eid
FROM event
WHERE end_time < now()
AND eid IN (SELECT eid FROM #event_members)
ORDER BY start_time DESC"
See that event_members holds all the entries you're hoping for - if so, find the issue in the 'events' query, if not, find the issue in the 'event_members' query.